74612024-01-09 09:46:12szabelrÁruszállítás üres szakaszaicpp17Wrong answer 15/50400ms20336 KiB
#include <iostream>

using namespace std;
long long aru[1000001]{0};
int main()
{
    int n,m,elozo=0,db=0;
    cin>>n>>m;
    int x,y;
    for(int i=1; i<=m; i++){
        cin>>x>>y;
        for(int z=x; z<=y; z++){
            aru[z]++;
        }
    }
    for(int i=1; i<=n; i++){
        if(aru[i]==0 and elozo==0){
            db++;
            elozo=1;
        }
        if(aru[i]!=0){
            elozo=0;
        }
    }
    cout<<db;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/03ms1880 KiB
2Accepted0/092ms17948 KiB
3Accepted2/23ms2564 KiB
4Accepted2/23ms2688 KiB
5Wrong answer0/23ms2916 KiB
6Wrong answer0/23ms3144 KiB
7Accepted2/23ms3260 KiB
8Wrong answer0/23ms3348 KiB
9Accepted2/23ms3592 KiB
10Accepted2/23ms3580 KiB
11Accepted2/23ms4124 KiB
12Wrong answer0/23ms5216 KiB
13Wrong answer0/37ms5364 KiB
14Wrong answer0/39ms6948 KiB
15Wrong answer0/38ms7292 KiB
16Time limit exceeded0/3400ms4388 KiB
17Time limit exceeded0/3358ms4364 KiB
18Time limit exceeded0/3352ms4496 KiB
19Wrong answer0/312ms10636 KiB
20Wrong answer0/313ms12348 KiB
21Wrong answer0/385ms20240 KiB
22Accepted3/386ms20336 KiB