69532023-12-21 08:57:24MagyarKendeSZLGÁruszállítás üres szakaszaicpp17Wrong answer 15/50358ms4236 KiB
#include <iostream>
#include <vector>
using namespace std;
#define speed cin.tie(0); ios::sync_with_stdio(0)

int main() {
    speed;
    
    int N, M;
    cin >> N >> M;
    vector<bool> line(N + 1);

    while (M--) {
        int E, V;
        cin >> E >> V;
        for (; E <= V; E++) {
            line[E] = 1;
        }
    }

    int result = 0;
    for (int i = 1; i <= N; i++) {
        if (!line[i]) {
            result++;
            while (i + 1 < line.size() && !line[i + 1]) i++;
        }
    }
    
    cout << result;
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/03ms1824 KiB
2Accepted0/057ms2308 KiB
3Accepted2/23ms2404 KiB
4Accepted2/23ms2536 KiB
5Wrong answer0/23ms2552 KiB
6Wrong answer0/23ms2484 KiB
7Accepted2/23ms2608 KiB
8Wrong answer0/23ms2824 KiB
9Accepted2/23ms2880 KiB
10Accepted2/23ms2876 KiB
11Accepted2/23ms3024 KiB
12Wrong answer0/23ms3012 KiB
13Wrong answer0/34ms2896 KiB
14Wrong answer0/36ms2900 KiB
15Wrong answer0/34ms3032 KiB
16Time limit exceeded0/3358ms3448 KiB
17Time limit exceeded0/3358ms3692 KiB
18Time limit exceeded0/3358ms3904 KiB
19Wrong answer0/38ms3824 KiB
20Wrong answer0/38ms3840 KiB
21Wrong answer0/350ms4156 KiB
22Accepted3/354ms4236 KiB