11691 | 2024-11-05 13:08:51 | bzy | Zsonglőrködés | cpp17 | Time limit exceeded 35/100 | 1.6s | 6452 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
int n; cin >> n;
vector < pair <int, int> > A(n);
for(int i = 0; i < n; i++){
cin >> A[i].first >> A[i].second;
}
sort(A.begin(), A.end());
vector <int> G;
for(int i = 0; i < n; i++){
bool found = false;
for(int j = 0; j < G.size(); j++){
if(G[j] == A[i].first){
found = true;
G[j] = A[i].second;
break;
}
}
if(!found) G.push_back(A[i].second);
}
cout << G.size() << '\n';
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 1ms | 320 KiB | ||||
2 | Accepted | 1ms | 500 KiB | ||||
subtask2 | 0/20 | ||||||
3 | Accepted | 4ms | 424 KiB | ||||
4 | Accepted | 929ms | 2412 KiB | ||||
5 | Time limit exceeded | 1.598s | 5024 KiB | ||||
6 | Time limit exceeded | 1.598s | 5908 KiB | ||||
7 | Time limit exceeded | 1.598s | 6320 KiB | ||||
8 | Time limit exceeded | 1.583s | 6324 KiB | ||||
9 | Time limit exceeded | 1.588s | 6284 KiB | ||||
10 | Time limit exceeded | 1.588s | 6328 KiB | ||||
11 | Time limit exceeded | 1.6s | 6440 KiB | ||||
subtask3 | 35/35 | ||||||
12 | Accepted | 1ms | 320 KiB | ||||
13 | Accepted | 1ms | 320 KiB | ||||
14 | Accepted | 1ms | 320 KiB | ||||
15 | Accepted | 2ms | 508 KiB | ||||
16 | Accepted | 1ms | 320 KiB | ||||
17 | Accepted | 2ms | 320 KiB | ||||
18 | Accepted | 1ms | 320 KiB | ||||
19 | Accepted | 2ms | 320 KiB | ||||
20 | Accepted | 1ms | 320 KiB | ||||
subtask4 | 0/45 | ||||||
21 | Accepted | 4ms | 456 KiB | ||||
22 | Accepted | 382ms | 2412 KiB | ||||
23 | Time limit exceeded | 1.598s | 4908 KiB | ||||
24 | Time limit exceeded | 1.598s | 5776 KiB | ||||
25 | Time limit exceeded | 1.578s | 6316 KiB | ||||
26 | Time limit exceeded | 1.588s | 6324 KiB | ||||
27 | Time limit exceeded | 1.585s | 6368 KiB | ||||
28 | Time limit exceeded | 1.587s | 6324 KiB | ||||
29 | Time limit exceeded | 1.6s | 6452 KiB |