9812022-02-13 14:14:46Kevinke12Áruszállítás (75 pont)cpp14Accepted 75/7590ms14700 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int N, M, be1, be2;
int t[1000005]; //Kezd s Vg mdostsa

int main()
{
    cin >> N >> M;
    for(int i = 0; i < M; i++)
    {
        cin >> be1 >> be2;
        t[be1]++;
        t[be2]--;
    }

    int aktAru=0, ans=0;
    for(int i = 1; i < N; i++)
    {
        aktAru+=t[i]; //Vltozs
        if(aktAru==0)
            ans++;
    }

    cout << ans << "\n";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/02ms1912 KiB
2Accepted0/090ms11176 KiB
3Accepted3/31ms3424 KiB
4Accepted3/31ms3432 KiB
5Accepted3/31ms3432 KiB
6Accepted3/31ms3440 KiB
7Accepted3/31ms3440 KiB
8Accepted4/41ms3448 KiB
9Accepted4/41ms3452 KiB
10Accepted4/41ms3452 KiB
11Accepted4/41ms3720 KiB
12Accepted4/42ms4072 KiB
13Accepted4/47ms4216 KiB
14Accepted4/48ms5024 KiB
15Accepted4/46ms5136 KiB
16Accepted4/48ms3932 KiB
17Accepted4/47ms4248 KiB
18Accepted4/48ms4320 KiB
19Accepted4/48ms7284 KiB
20Accepted4/410ms8184 KiB
21Accepted4/471ms13344 KiB
22Accepted4/472ms14700 KiB