70152023-12-26 21:32:43xxxÁruszállítás (75 pont)cpp11Accepted 75/7541ms19532 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t = 1;
    //cin >> t;
    while(t--) {
        int n, m;
        cin >> n >> m;
        vector<int> a(n);
        for(int i = 0; i < m; i++) {
            int x, y;
            cin >> x >> y, x--, y--;
            a[x]++;
            a[y]--;
        }

        for(int i = 1; i < n; i++) {
            a[i] += a[i-1];
        }

        int ans = 0;

        for(int i = 0; i < n-1; i++) {
            if (!a[i]) ans++;
        }

        cout << ans << '\n';

    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1824 KiB
2Accepted0/041ms17656 KiB
3Accepted3/33ms2340 KiB
4Accepted3/33ms2340 KiB
5Accepted3/33ms2544 KiB
6Accepted3/33ms2624 KiB
7Accepted3/33ms2632 KiB
8Accepted4/43ms2716 KiB
9Accepted4/43ms2628 KiB
10Accepted4/43ms2752 KiB
11Accepted4/43ms3696 KiB
12Accepted4/44ms4356 KiB
13Accepted4/44ms4572 KiB
14Accepted4/47ms6052 KiB
15Accepted4/44ms6032 KiB
16Accepted4/47ms7976 KiB
17Accepted4/48ms9492 KiB
18Accepted4/48ms11228 KiB
19Accepted4/48ms9820 KiB
20Accepted4/49ms11292 KiB
21Accepted4/437ms19480 KiB
22Accepted4/439ms19532 KiB