6175 | 2023-11-05 13:39:48 | MCDave | Zsonglőrködés | cpp17 | Time limit exceeded 35/100 | 1.6s | 5936 KiB |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> begin(n);
vector<int> end(n);
vector<int> minus(n, 0);
for (int i = 0; i < n; i++)
{
int temp1 = 0, temp2 = 0;
cin >> temp1 >> temp2;
begin[i] = temp1;
end[i] = temp2;
}
sort(begin.begin(), begin.end());
sort(end.begin(), end.end());
int days = 0, temp2 = 0;
for (int i = 0; i < n; i++)
{
auto temp1 = find(end.begin(), end.end(), begin[i]);
if (temp1 != end.end())
{
*temp1 = 0;
begin[i] = 0;
}
else
{
days++;
}
}
cout << days;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1748 KiB | ||||
2 | Accepted | 3ms | 1984 KiB | ||||
subtask2 | 0/20 | ||||||
3 | Accepted | 7ms | 2252 KiB | ||||
4 | Time limit exceeded | 1.6s | 2132 KiB | ||||
5 | Time limit exceeded | 1.57s | 3492 KiB | ||||
6 | Time limit exceeded | 1.554s | 4036 KiB | ||||
7 | Time limit exceeded | 1.562s | 4380 KiB | ||||
8 | Time limit exceeded | 1.554s | 4532 KiB | ||||
9 | Time limit exceeded | 1.574s | 4848 KiB | ||||
10 | Time limit exceeded | 1.557s | 5160 KiB | ||||
11 | Time limit exceeded | 1.557s | 5172 KiB | ||||
subtask3 | 35/35 | ||||||
12 | Accepted | 3ms | 3868 KiB | ||||
13 | Accepted | 3ms | 3992 KiB | ||||
14 | Accepted | 3ms | 3996 KiB | ||||
15 | Accepted | 3ms | 3892 KiB | ||||
16 | Accepted | 4ms | 4104 KiB | ||||
17 | Accepted | 4ms | 4216 KiB | ||||
18 | Accepted | 3ms | 4080 KiB | ||||
19 | Accepted | 4ms | 4080 KiB | ||||
20 | Accepted | 4ms | 4080 KiB | ||||
subtask4 | 0/45 | ||||||
21 | Accepted | 7ms | 4092 KiB | ||||
22 | Accepted | 1.485s | 5304 KiB | ||||
23 | Time limit exceeded | 1.574s | 5308 KiB | ||||
24 | Time limit exceeded | 1.582s | 5616 KiB | ||||
25 | Time limit exceeded | 1.57s | 5856 KiB | ||||
26 | Time limit exceeded | 1.549s | 5904 KiB | ||||
27 | Time limit exceeded | 1.557s | 5912 KiB | ||||
28 | Time limit exceeded | 1.549s | 5936 KiB | ||||
29 | Time limit exceeded | 1.565s | 5920 KiB |