64392023-11-29 21:01:04Pbg4444Áruszállítás (75 pont)cpp17Accepted 75/7578ms16084 KiB
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int n,m;
    cin>>n>>m;

    vector<int> a(n, 0);
    int trash1,trash2;
    for(int i=0;i<m;i++){
        cin>>trash1>>trash2;
        a[trash1]++;
        a[trash2]--;
    }
    int sum=0, actual=0;
    for (int i = 1; i < n; i++) {
        actual+=a[i];

        if (actual==0) {
            sum++;
        }
    }
    cout<<sum<<endl;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1808 KiB
2Accepted0/078ms10980 KiB
3Accepted3/33ms3428 KiB
4Accepted3/33ms3644 KiB
5Accepted3/33ms3864 KiB
6Accepted3/33ms4056 KiB
7Accepted3/33ms4276 KiB
8Accepted4/43ms4492 KiB
9Accepted4/43ms4576 KiB
10Accepted4/43ms4688 KiB
11Accepted4/43ms5008 KiB
12Accepted4/43ms5296 KiB
13Accepted4/47ms5304 KiB
14Accepted4/48ms6040 KiB
15Accepted4/47ms6392 KiB
16Accepted4/48ms7472 KiB
17Accepted4/48ms8232 KiB
18Accepted4/49ms9388 KiB
19Accepted4/49ms8528 KiB
20Accepted4/410ms9568 KiB
21Accepted4/471ms14616 KiB
22Accepted4/475ms16084 KiB