8232022-01-18 11:26:07zsebiÁruszállítás üres szakaszaicpp11Wrong answer 0/502ms2044 KiB
//#include <iostream>
#include <fstream>
#include <algorithm>

using namespace std;

struct aru
{
    int k,v;

};
aru y[1000001];
int has (aru a, aru b)
{
    if(a.k<b.k) return 1;
    else return 0;
}

ifstream cin("aru.in");
ofstream cout("aru.out");
long long n,m,i,x[1000002],a,b,db,db2;

int main()
{
    cin>>n>>m;
    for(i=1;i<=m;++i)
    {
        cin>>a>>b;

        x[a]++;
        x[b]--;

    }
    //sort(y+1,y+m+1,has);
    for(i=1;i<=n;++i)
    {
        x[i]+=x[i-1];

    }
//for(i=1;i<=n;++i)cout<<x[i];
x[n+1]=5;
    for(i=1;i<=n+1;++i)
    {
        if(x[i]==0)db++;
        else if( x[i-1]==0&&db>=1)
        {
            db2++;
            db=0;
        }

    }
    cout<<db2;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/02ms1936 KiB
2Wrong answer0/01ms1972 KiB
3Wrong answer0/21ms2036 KiB
4Wrong answer0/21ms2040 KiB
5Wrong answer0/21ms2032 KiB
6Wrong answer0/21ms2032 KiB
7Wrong answer0/21ms2044 KiB
8Wrong answer0/21ms2032 KiB
9Wrong answer0/21ms2040 KiB
10Wrong answer0/21ms2032 KiB
11Wrong answer0/21ms2040 KiB
12Wrong answer0/21ms2040 KiB
13Wrong answer0/31ms2040 KiB
14Wrong answer0/31ms2040 KiB
15Wrong answer0/31ms2040 KiB
16Wrong answer0/31ms2032 KiB
17Wrong answer0/31ms2032 KiB
18Wrong answer0/31ms2040 KiB
19Wrong answer0/31ms2040 KiB
20Wrong answer0/31ms2044 KiB
21Wrong answer0/31ms2032 KiB
22Wrong answer0/31ms2040 KiB