143372025-01-10 16:44:22MittomenJárdakövezés (75 pont)cpp17Wrong answer 0/751ms508 KiB
#include <list>
#include <iostream>
#include <vector>
#include <bitset>
#include <algorithm>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n, m;
    cin >> n >> m;

    vector<pair<int, int>> stops(m+1);

    for (int i = 0; i < m; i++) {
        cin >> stops[i].first >> stops[i].second;
    }
    stops[m] = pair<int, int>(n, 0);

    sort(stops.begin(), stops.end());

    int empty_at = 1;
    int empty_intervals = 0;
    for (pair<int, int>& stop : stops) {
        if (empty_at < stop.first) empty_intervals++;
        empty_at = max(empty_at, stop.second);
    }

    cout << empty_intervals;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/75
1Wrong answer0/01ms316 KiB
2Wrong answer0/01ms316 KiB
3Wrong answer0/31ms324 KiB
4Wrong answer0/31ms496 KiB
5Wrong answer0/31ms316 KiB
6Wrong answer0/31ms316 KiB
7Wrong answer0/31ms508 KiB
8Wrong answer0/41ms316 KiB
9Wrong answer0/41ms316 KiB
10Wrong answer0/41ms316 KiB
11Wrong answer0/41ms316 KiB
12Wrong answer0/41ms508 KiB
13Wrong answer0/41ms316 KiB
14Wrong answer0/41ms508 KiB
15Wrong answer0/41ms316 KiB
16Wrong answer0/41ms316 KiB
17Wrong answer0/41ms500 KiB
18Wrong answer0/41ms316 KiB
19Wrong answer0/41ms316 KiB
20Wrong answer0/41ms508 KiB
21Wrong answer0/41ms332 KiB
22Wrong answer0/41ms316 KiB