8242022-01-18 11:26:56zsebiÁruszállítás üres szakaszaicpp11Wrong answer 14/5087ms25844 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
base14/50
1Accepted0/02ms1808 KiB
2Wrong answer0/087ms18912 KiB
3Accepted2/21ms3364 KiB
4Wrong answer0/21ms3364 KiB
5Accepted2/21ms3376 KiB
6Accepted2/21ms3376 KiB
7Accepted2/21ms3380 KiB
8Accepted2/21ms3380 KiB
9Wrong answer0/21ms3384 KiB
10Wrong answer0/21ms3396 KiB
11Accepted2/21ms4244 KiB
12Accepted2/22ms4756 KiB
13Wrong answer0/34ms4896 KiB
14Wrong answer0/38ms6448 KiB
15Wrong answer0/36ms6436 KiB
16Wrong answer0/357ms20428 KiB
17Wrong answer0/361ms21608 KiB
18Wrong answer0/379ms22912 KiB
19Wrong answer0/39ms13704 KiB
20Wrong answer0/312ms15460 KiB
21Wrong answer0/374ms24536 KiB
22Wrong answer0/378ms25844 KiB