123632024-12-13 10:49:35szabelrÁruszállítás üres szakaszaicpp17Wrong answer 15/50400ms8204 KiB
#include <iostream>

using namespace std;
long long aru[1000001]{0};

int main()
{
    long long n,m,db=0;
    cin>>n>>m;
    int x,y;
    aru[n+1]=1;
    for(int i=1; i<=m; i++){
        cin>>x>>y;
        for(int z=x; z<=y; z++){
            aru[z]=1;
        }
    }
    for(int i=1; i<=n; i++){
        if(aru[i]==0 and aru[i+1]!=0){
            db++;
        }
        if(aru[i]==0 and i==n)
            db++;

    }
    cout<<db;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Wrong answer0/01ms320 KiB
2Accepted0/092ms8204 KiB
3Wrong answer0/21ms320 KiB
4Accepted2/21ms320 KiB
5Accepted2/21ms320 KiB
6Accepted2/21ms320 KiB
7Wrong answer0/21ms320 KiB
8Accepted2/21ms320 KiB
9Accepted2/21ms320 KiB
10Accepted2/21ms320 KiB
11Wrong answer0/21ms568 KiB
12Wrong answer0/22ms1004 KiB
13Wrong answer0/36ms1080 KiB
14Wrong answer0/38ms1628 KiB
15Wrong answer0/36ms1640 KiB
16Time limit exceeded0/3400ms1164 KiB
17Time limit exceeded0/3398ms1632 KiB
18Time limit exceeded0/3400ms1336 KiB
19Wrong answer0/39ms3556 KiB
20Wrong answer0/313ms4152 KiB
21Wrong answer0/381ms8092 KiB
22Accepted3/383ms7992 KiB