75592024-01-09 16:37:06AblablablaÁruszállítás (75 pont)cpp17Accepted 75/7581ms11112 KiB
#include <bits/stdc++.h>

using namespace std;

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

    vector<int> szamok(n, 0);
    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;

        szamok[a]++;
        szamok[b]--;
    }

    int akt = 0;
    int valasz = 0;

    for(int i = 0; i < n; i++){
        akt += szamok[i];

        if(akt == 0 && i != n - 1){
            valasz++;
        }
    }

    cout << valasz << "\n";
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1812 KiB
2Accepted0/081ms10008 KiB
3Accepted3/33ms2324 KiB
4Accepted3/33ms2396 KiB
5Accepted3/33ms2732 KiB
6Accepted3/33ms2868 KiB
7Accepted3/32ms2936 KiB
8Accepted4/42ms2844 KiB
9Accepted4/43ms2944 KiB
10Accepted4/43ms3100 KiB
11Accepted4/43ms3616 KiB
12Accepted4/43ms3820 KiB
13Accepted4/47ms4096 KiB
14Accepted4/48ms4612 KiB
15Accepted4/47ms4688 KiB
16Accepted4/48ms5640 KiB
17Accepted4/49ms6372 KiB
18Accepted4/410ms7200 KiB
19Accepted4/49ms6292 KiB
20Accepted4/410ms7276 KiB
21Accepted4/471ms11096 KiB
22Accepted4/475ms11112 KiB