8762022-01-22 14:36:56Zoli9Áruszállítás (75 pont)cpp11Accepted 75/7535ms14520 KiB
#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin>>n>>m;

    vector<int> meddig(n+1);
    for(int i=0; i<m; i++) {
        int kezdo, veg;
        cin>>kezdo>>veg;
        meddig[kezdo]=max(meddig[kezdo], veg);
    }
    int valasz=0;
    int legtavolabbi=1;
    for(int i=1; i<=n; i++)
    {
        if(legtavolabbi<i) {
            valasz++;
        }
        legtavolabbi=max(legtavolabbi, meddig[i]);
    }
    cout<<valasz<<endl;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/02ms1760 KiB
2Accepted0/035ms10932 KiB
3Accepted3/31ms3312 KiB
4Accepted3/31ms3308 KiB
5Accepted3/31ms3316 KiB
6Accepted3/31ms3324 KiB
7Accepted3/31ms3320 KiB
8Accepted4/41ms3332 KiB
9Accepted4/41ms3328 KiB
10Accepted4/41ms3340 KiB
11Accepted4/41ms3664 KiB
12Accepted4/42ms4056 KiB
13Accepted4/42ms4068 KiB
14Accepted4/44ms4792 KiB
15Accepted4/43ms4896 KiB
16Accepted4/44ms6008 KiB
17Accepted4/44ms6756 KiB
18Accepted4/44ms7776 KiB
19Accepted4/44ms6988 KiB
20Accepted4/44ms8020 KiB
21Accepted4/429ms13216 KiB
22Accepted4/429ms14520 KiB