80442024-01-12 11:24:15David9320Áruszállítás (75 pont)cpp17Time limit exceeded 63/75400ms4272 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/03ms1816 KiB
2Accepted0/0101ms2296 KiB
3Accepted3/33ms2308 KiB
4Accepted3/33ms2468 KiB
5Accepted3/33ms2636 KiB
6Accepted3/33ms2752 KiB
7Accepted3/32ms2824 KiB
8Accepted4/43ms3068 KiB
9Accepted4/43ms3152 KiB
10Accepted4/43ms3036 KiB
11Accepted4/43ms3080 KiB
12Accepted4/43ms3312 KiB
13Accepted4/47ms3524 KiB
14Accepted4/48ms3768 KiB
15Accepted4/46ms3724 KiB
16Time limit exceeded0/4400ms3064 KiB
17Time limit exceeded0/4365ms3436 KiB
18Time limit exceeded0/4372ms4104 KiB
19Accepted4/410ms4064 KiB
20Accepted4/412ms4076 KiB
21Accepted4/490ms4272 KiB
22Accepted4/496ms4268 KiB