80402024-01-12 11:18:57David9320Áruszállítás (75 pont)cpp17Time limit exceeded 63/75400ms4132 KiB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    int eredmeny = 0;

    vector<bool> palya(n + 1);

    for(int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        for(int i = x; i < y; i++) {
            palya[i] = true;
        }
    }

    for(int i = 1; i <= n; i++) {
        if(!palya[i]) {
            eredmeny++;
        }
    }

    cout << eredmeny - 1;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base63/75
1Accepted0/03ms1812 KiB
2Accepted0/0103ms2252 KiB
3Accepted3/33ms2084 KiB
4Accepted3/33ms2360 KiB
5Accepted3/33ms2436 KiB
6Accepted3/33ms2644 KiB
7Accepted3/33ms2856 KiB
8Accepted4/43ms3072 KiB
9Accepted4/43ms3152 KiB
10Accepted4/43ms3288 KiB
11Accepted4/43ms3376 KiB
12Accepted4/43ms3408 KiB
13Accepted4/47ms3508 KiB
14Accepted4/48ms3388 KiB
15Accepted4/46ms3488 KiB
16Time limit exceeded0/4400ms2716 KiB
17Time limit exceeded0/4365ms2864 KiB
18Time limit exceeded0/4349ms3004 KiB
19Accepted4/410ms3632 KiB
20Accepted4/412ms3640 KiB
21Accepted4/490ms3884 KiB
22Accepted4/497ms4132 KiB