8252022-01-18 11:44:06zsebiÁruszállítás üres szakaszaicpp11Wrong answer 0/502ms2032 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]=5;
    for(i=1;i<=n;++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/02ms1932 KiB
2Wrong answer0/01ms1960 KiB
3Wrong answer0/21ms2032 KiB
4Wrong answer0/21ms2020 KiB
5Wrong answer0/21ms2020 KiB
6Wrong answer0/21ms2032 KiB
7Wrong answer0/21ms2032 KiB
8Wrong answer0/21ms2024 KiB
9Wrong answer0/21ms2028 KiB
10Wrong answer0/21ms2020 KiB
11Wrong answer0/21ms2028 KiB
12Wrong answer0/21ms2028 KiB
13Wrong answer0/31ms2028 KiB
14Wrong answer0/31ms2020 KiB
15Wrong answer0/31ms2028 KiB
16Wrong answer0/31ms2020 KiB
17Wrong answer0/31ms2020 KiB
18Wrong answer0/32ms2020 KiB
19Wrong answer0/31ms2028 KiB
20Wrong answer0/31ms2028 KiB
21Wrong answer0/31ms2032 KiB
22Wrong answer0/31ms2028 KiB