33432023-02-26 13:48:31ZdragonÁruszállítás (75 pont)cpp17Runtime error 51/75238ms64864 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, szamlalo=0, szamlalo2=0;cin >> n >> m;
    map<int ,int> felveves;
    map<int ,int> leadas;
    for(int i=0; i<m; i++){
        int a , b;
        cin >> a >> b;
        felveves[a]++;
        leadas[b]++;
    }
    for(int i=0; i<n;i++){
        szamlalo+=felveves[i];
        szamlalo-=leadas[i];
        szamlalo2+= szamlalo == 0 ? 1 : 0;
    }
    cout << szamlalo2-1 << '\n';
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base51/75
1Accepted0/03ms1824 KiB
2Runtime error0/0238ms64864 KiB
3Accepted3/33ms2372 KiB
4Accepted3/33ms2592 KiB
5Accepted3/33ms2712 KiB
6Accepted3/33ms2936 KiB
7Accepted3/33ms3280 KiB
8Accepted4/43ms3204 KiB
9Accepted4/43ms3328 KiB
10Accepted4/43ms3572 KiB
11Accepted4/430ms14700 KiB
12Accepted4/445ms20672 KiB
13Accepted4/454ms20656 KiB
14Accepted4/4112ms37772 KiB
15Accepted4/4107ms38172 KiB
16Accepted4/4209ms60076 KiB
17Runtime error0/4193ms63188 KiB
18Runtime error0/4196ms62952 KiB
19Runtime error0/4155ms62928 KiB
20Runtime error0/4159ms62908 KiB
21Runtime error0/4210ms62884 KiB
22Runtime error0/4214ms62844 KiB