74752024-01-09 09:56:02szabelrÁruszállítás üres szakaszaicpp17Wrong answer 15/50363ms19160 KiB
#include <iostream>

using namespace std;
long long aru[1000001]{0};
int main()
{
    long long 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=false;
        }
    }
    cout<<db;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/03ms1876 KiB
2Accepted0/093ms17736 KiB
3Accepted2/23ms2296 KiB
4Accepted2/23ms2436 KiB
5Wrong answer0/23ms2624 KiB
6Wrong answer0/23ms2836 KiB
7Accepted2/23ms3064 KiB
8Wrong answer0/23ms3104 KiB
9Accepted2/23ms3232 KiB
10Accepted2/23ms3316 KiB
11Accepted2/23ms3596 KiB
12Wrong answer0/24ms4608 KiB
13Wrong answer0/38ms4672 KiB
14Wrong answer0/39ms6144 KiB
15Wrong answer0/38ms6160 KiB
16Time limit exceeded0/3363ms3316 KiB
17Time limit exceeded0/3345ms3680 KiB
18Time limit exceeded0/3358ms3880 KiB
19Wrong answer0/312ms9860 KiB
20Wrong answer0/313ms11288 KiB
21Wrong answer0/386ms19160 KiB
22Accepted3/390ms19156 KiB