15842022-11-28 16:00:56kovacs.peter.18fÁruszállítás üres szakaszaicpp11Wrong answer 2/5092ms20200 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(N);
    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 += e.first - last;
        }
        last = max(last, e.second);
    }
    cout << answer + N - last << '\n';
}
SubtaskSumTestVerdictTimeMemory
base2/50
1Wrong answer0/03ms1832 KiB
2Wrong answer0/092ms17680 KiB
3Wrong answer0/22ms2224 KiB
4Accepted2/22ms2428 KiB
5Wrong answer0/22ms2628 KiB
6Wrong answer0/22ms2836 KiB
7Wrong answer0/22ms3036 KiB
8Wrong answer0/22ms3240 KiB
9Wrong answer0/22ms3444 KiB
10Wrong answer0/22ms3516 KiB
11Wrong answer0/24ms4464 KiB
12Wrong answer0/28ms5192 KiB
13Wrong answer0/38ms5136 KiB
14Wrong answer0/314ms6704 KiB
15Wrong answer0/314ms6960 KiB
16Wrong answer0/386ms19896 KiB
17Wrong answer0/386ms19956 KiB
18Wrong answer0/387ms19844 KiB
19Wrong answer0/328ms10416 KiB
20Wrong answer0/334ms11976 KiB
21Wrong answer0/389ms20032 KiB
22Wrong answer0/390ms20200 KiB