6172 | 2023-11-05 12:28:32 | Ghost | Zsonglőrködés | cpp17 | Wrong answer 0/100 | 1.6s | 5316 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;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 3ms | 1808 KiB | ||||
2 | Wrong answer | 3ms | 2064 KiB | ||||
subtask2 | 0/20 | ||||||
3 | Wrong answer | 6ms | 2236 KiB | ||||
4 | Time limit exceeded | 1.565s | 2204 KiB | ||||
5 | Time limit exceeded | 1.574s | 3004 KiB | ||||
6 | Time limit exceeded | 1.549s | 3212 KiB | ||||
7 | Time limit exceeded | 1.569s | 3576 KiB | ||||
8 | Time limit exceeded | 1.572s | 3476 KiB | ||||
9 | Time limit exceeded | 1.565s | 3864 KiB | ||||
10 | Time limit exceeded | 1.57s | 4004 KiB | ||||
11 | Time limit exceeded | 1.565s | 4148 KiB | ||||
subtask3 | 0/35 | ||||||
12 | Accepted | 3ms | 3836 KiB | ||||
13 | Wrong answer | 3ms | 3816 KiB | ||||
14 | Wrong answer | 3ms | 3648 KiB | ||||
15 | Wrong answer | 3ms | 3904 KiB | ||||
16 | Wrong answer | 4ms | 3764 KiB | ||||
17 | Wrong answer | 4ms | 3912 KiB | ||||
18 | Wrong answer | 4ms | 3832 KiB | ||||
19 | Wrong answer | 3ms | 3836 KiB | ||||
20 | Wrong answer | 3ms | 3944 KiB | ||||
subtask4 | 0/45 | ||||||
21 | Accepted | 6ms | 3968 KiB | ||||
22 | Time limit exceeded | 1.6s | 3748 KiB | ||||
23 | Time limit exceeded | 1.565s | 4516 KiB | ||||
24 | Time limit exceeded | 1.58s | 4816 KiB | ||||
25 | Time limit exceeded | 1.57s | 5304 KiB | ||||
26 | Time limit exceeded | 1.534s | 5204 KiB | ||||
27 | Time limit exceeded | 1.572s | 5216 KiB | ||||
28 | Time limit exceeded | 1.572s | 5116 KiB | ||||
29 | Time limit exceeded | 1.565s | 5316 KiB |