131532025-01-06 19:07:54SMC40Áruszállítás üres szakaszaicpp17Wrong answer 2/5085ms4324 KiB
#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n,m,x,y;
    cin >>n>>m;
    vector<int>b(n+1);
    b[0]=1;
    for(int i=0;i<m;i++){
        cin >>x>>y;
        b[x]++;
        b[y]--;
    }
    cout <<endl;
    int cnt=0,c=b[1],d=0;
    for(int i=2;i<=n;i++){
        if(d!=0&&c==0){
            cnt++;
        }
        d=c;
        c+=b[i];
    }
    cout <<cnt<<endl;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base2/50
1Accepted0/01ms316 KiB
2Wrong answer0/085ms4148 KiB
3Wrong answer0/21ms316 KiB
4Accepted2/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/21ms316 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/21ms356 KiB
10Wrong answer0/21ms316 KiB
11Wrong answer0/21ms564 KiB
12Wrong answer0/21ms564 KiB
13Wrong answer0/34ms564 KiB
14Wrong answer0/38ms1272 KiB
15Wrong answer0/36ms1076 KiB
16Wrong answer0/364ms4148 KiB
17Wrong answer0/364ms4324 KiB
18Wrong answer0/372ms4148 KiB
19Wrong answer0/38ms1844 KiB
20Wrong answer0/39ms2372 KiB
21Wrong answer0/372ms4152 KiB
22Wrong answer0/375ms4320 KiB