61722023-11-05 12:28:32GhostZsonglőrködéscpp17Wrong answer 0/1001.6s5316 KiB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int n, i, out = 0;
    cin >> n;

    vector<pair<int, int>> foglalasok(n);
    vector<bool> van(n, 0);
    for (i = 0; i < n; i++) {
        cin >> foglalasok[i].first >> foglalasok[i].second;
    }

    sort(foglalasok.begin(), foglalasok.end(), [](pair<int, int> a, pair<int, int> b) {
        if (a.second == b.second) {
            return a.first < b.first;
        }
        else {
            return a.second < b.second;
        }
    });
   
    while (out != n && foglalasok.size() > 0) {
        int last = foglalasok[0].second;
        i = 1;
        while (i < foglalasok.size()) {
            if (foglalasok[i].first == last && van[i]) {
                van[i] = 1;
                last = foglalasok[i].second;
            }
            i++;
        }
        out++;
    }
    cout << out;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer3ms1808 KiB
2Wrong answer3ms2064 KiB
subtask20/20
3Wrong answer6ms2236 KiB
4Time limit exceeded1.565s2204 KiB
5Time limit exceeded1.574s3004 KiB
6Time limit exceeded1.549s3212 KiB
7Time limit exceeded1.569s3576 KiB
8Time limit exceeded1.572s3476 KiB
9Time limit exceeded1.565s3864 KiB
10Time limit exceeded1.57s4004 KiB
11Time limit exceeded1.565s4148 KiB
subtask30/35
12Accepted3ms3836 KiB
13Wrong answer3ms3816 KiB
14Wrong answer3ms3648 KiB
15Wrong answer3ms3904 KiB
16Wrong answer4ms3764 KiB
17Wrong answer4ms3912 KiB
18Wrong answer4ms3832 KiB
19Wrong answer3ms3836 KiB
20Wrong answer3ms3944 KiB
subtask40/45
21Accepted6ms3968 KiB
22Time limit exceeded1.6s3748 KiB
23Time limit exceeded1.565s4516 KiB
24Time limit exceeded1.58s4816 KiB
25Time limit exceeded1.57s5304 KiB
26Time limit exceeded1.534s5204 KiB
27Time limit exceeded1.572s5216 KiB
28Time limit exceeded1.572s5116 KiB
29Time limit exceeded1.565s5316 KiB