74662024-01-09 09:47:34szabelrÁruszállítás üres szakaszaicpp17Wrong answer 15/50400ms19276 KiB
#include <iostream>

using namespace std;
long long aru[1000001]{0};
int main()
{
    int n,m,db=0;
    bool elozo=false;
    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==false){
            db++;
            elozo=true;
        }
        if(aru[i]!=0){
            elozo=0;
        }
    }
    cout<<db;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/03ms1876 KiB
2Accepted0/097ms17692 KiB
3Accepted2/23ms2288 KiB
4Accepted2/23ms2368 KiB
5Wrong answer0/23ms2496 KiB
6Wrong answer0/23ms2708 KiB
7Accepted2/23ms2816 KiB
8Wrong answer0/23ms2792 KiB
9Accepted2/23ms2916 KiB
10Accepted2/23ms2992 KiB
11Accepted2/23ms3280 KiB
12Wrong answer0/24ms4644 KiB
13Wrong answer0/37ms4444 KiB
14Wrong answer0/39ms6048 KiB
15Wrong answer0/38ms6148 KiB
16Time limit exceeded0/3400ms3224 KiB
17Time limit exceeded0/3370ms3204 KiB
18Time limit exceeded0/3358ms3444 KiB
19Wrong answer0/312ms9520 KiB
20Wrong answer0/314ms11328 KiB
21Wrong answer0/393ms19276 KiB
22Accepted3/396ms19268 KiB