61742023-11-05 12:47:30GhostZsonglőrködéscpp17Wrong answer 0/1001.6s5732 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, 1);
    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] = 0;
                last = foglalasok[i].second;
            }
            i++;
        }
        out++;
    }
    cout << out;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer3ms1684 KiB
2Wrong answer3ms1892 KiB
subtask20/20
3Wrong answer7ms2288 KiB
4Time limit exceeded1.574s2256 KiB
5Time limit exceeded1.554s2988 KiB
6Time limit exceeded1.554s3320 KiB
7Time limit exceeded1.546s3760 KiB
8Time limit exceeded1.57s3928 KiB
9Time limit exceeded1.569s4088 KiB
10Time limit exceeded1.565s4108 KiB
11Time limit exceeded1.549s4136 KiB
subtask30/35
12Accepted3ms3516 KiB
13Wrong answer3ms3684 KiB
14Wrong answer3ms3932 KiB
15Wrong answer3ms3924 KiB
16Wrong answer4ms3928 KiB
17Wrong answer4ms4024 KiB
18Wrong answer4ms4144 KiB
19Wrong answer4ms4244 KiB
20Wrong answer4ms4244 KiB
subtask40/45
21Accepted7ms4384 KiB
22Time limit exceeded1.6s4092 KiB
23Time limit exceeded1.549s5108 KiB
24Time limit exceeded1.572s5428 KiB
25Time limit exceeded1.537s5416 KiB
26Time limit exceeded1.582s5732 KiB
27Time limit exceeded1.562s5492 KiB
28Time limit exceeded1.58s5548 KiB
29Time limit exceeded1.565s5680 KiB