15852022-11-28 16:04:30kovacs.peter.18fÁruszállítás üres szakaszaicpp11Accepted 50/5035ms5688 KiB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    cin.sync_with_stdio(false);
    cin.tie(nullptr);

    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> transferS(M);
    for (auto &e : transferS) {
        cin >> e.first >> e.second;
    }
    sort(transferS.begin(), transferS.end());
    int answer = 0, last = 1;
    for (auto e : transferS) {
        if (e.first > last) {
            ++answer;
        }
        last = max(last, e.second);
    }
    if (N > last) {
        ++answer;
    }
    cout << answer << '\n';
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1824 KiB
2Accepted0/035ms3356 KiB
3Accepted2/22ms2228 KiB
4Accepted2/22ms2300 KiB
5Accepted2/22ms2700 KiB
6Accepted2/22ms2648 KiB
7Accepted2/22ms2856 KiB
8Accepted2/22ms3196 KiB
9Accepted2/22ms3004 KiB
10Accepted2/22ms3000 KiB
11Accepted2/22ms3280 KiB
12Accepted2/22ms3352 KiB
13Accepted3/34ms3720 KiB
14Accepted3/34ms4048 KiB
15Accepted3/34ms4092 KiB
16Accepted3/328ms5228 KiB
17Accepted3/328ms5452 KiB
18Accepted3/332ms5428 KiB
19Accepted3/34ms4420 KiB
20Accepted3/34ms4592 KiB
21Accepted3/332ms5644 KiB
22Accepted3/334ms5688 KiB