33442023-02-26 14:02:55ZdragonÁruszállítás (75 pont)cpp17Accepted 75/7530ms12072 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int n, m, szamlalo2=0;cin >> n >> m;
    vector<int> v(n+1);
    for(int i=0; i<m; i++){
        int a , b;
        cin >> a >> b;
        v[a]++;
        v[b]--;
    }
    for(int i=0; i<n; i++){
        v[i]+=v[i-1];
    }
    for(int i=0; i<n;i++){
        if(v[i]==0){
            szamlalo2++;
        }
    }
    cout << szamlalo2-1 << '\n';
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1832 KiB
2Accepted0/030ms9756 KiB
3Accepted3/33ms2420 KiB
4Accepted3/33ms2372 KiB
5Accepted3/32ms2528 KiB
6Accepted3/32ms2624 KiB
7Accepted3/33ms2768 KiB
8Accepted4/43ms2864 KiB
9Accepted4/43ms3076 KiB
10Accepted4/43ms3444 KiB
11Accepted4/43ms3768 KiB
12Accepted4/43ms4328 KiB
13Accepted4/44ms4424 KiB
14Accepted4/44ms5080 KiB
15Accepted4/44ms5216 KiB
16Accepted4/46ms6104 KiB
17Accepted4/47ms6752 KiB
18Accepted4/48ms7888 KiB
19Accepted4/47ms7136 KiB
20Accepted4/48ms8280 KiB
21Accepted4/429ms12072 KiB
22Accepted4/428ms11960 KiB