6090 | 2023-10-29 17:57:58 | Ignác | Zsonglőrködés | cpp11 | Wrong answer 0/100 | 1.6s | 6800 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<pair<long long, long long>> a(N);
for(int i = 0; i < N - 1; i++){
cin >> a[i].first >> a[i].second;
}
sort(a.begin(), a.end());
for(int i = 0; i < N; i++){
for(int j = i+1; j < N; j++){
if(a[i].second == a[j].first){
a[i].second = a[j].second;
a.erase(a.begin() + j);
break;
}
}
}
cout << a.size();
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 3ms | 1812 KiB | ||||
2 | Accepted | 2ms | 2004 KiB | ||||
subtask2 | 0/20 | ||||||
3 | Accepted | 8ms | 2408 KiB | ||||
4 | Time limit exceeded | 1.554s | 2808 KiB | ||||
5 | Time limit exceeded | 1.557s | 4300 KiB | ||||
6 | Time limit exceeded | 1.521s | 5040 KiB | ||||
7 | Time limit exceeded | 1.549s | 5360 KiB | ||||
8 | Time limit exceeded | 1.569s | 5580 KiB | ||||
9 | Time limit exceeded | 1.559s | 5624 KiB | ||||
10 | Time limit exceeded | 1.562s | 5592 KiB | ||||
11 | Time limit exceeded | 1.544s | 5964 KiB | ||||
subtask3 | 0/35 | ||||||
12 | Accepted | 3ms | 3724 KiB | ||||
13 | Wrong answer | 3ms | 3884 KiB | ||||
14 | Wrong answer | 3ms | 3920 KiB | ||||
15 | Wrong answer | 3ms | 3924 KiB | ||||
16 | Wrong answer | 4ms | 3900 KiB | ||||
17 | Wrong answer | 4ms | 4004 KiB | ||||
18 | Wrong answer | 4ms | 4000 KiB | ||||
19 | Wrong answer | 4ms | 4096 KiB | ||||
20 | Wrong answer | 4ms | 3996 KiB | ||||
subtask4 | 0/45 | ||||||
21 | Accepted | 7ms | 4020 KiB | ||||
22 | Time limit exceeded | 1.6s | 4388 KiB | ||||
23 | Time limit exceeded | 1.574s | 5788 KiB | ||||
24 | Time limit exceeded | 1.536s | 6236 KiB | ||||
25 | Time limit exceeded | 1.577s | 6384 KiB | ||||
26 | Time limit exceeded | 1.554s | 6684 KiB | ||||
27 | Time limit exceeded | 1.557s | 6800 KiB | ||||
28 | Time limit exceeded | 1.565s | 6792 KiB | ||||
29 | Time limit exceeded | 1.559s | 6640 KiB |