6085 | 2023-10-29 17:45:38 | Ignác | Zsonglőrködés | cpp11 | Time limit exceeded 0/100 | 1.577s | 59680 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<pair<int, int>> 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 = N-1; i >= 0; i--){
for(int j = i-1; j >= 0; j--){
if(a[j].second == a[i].first){
a[j].second = a[i].second;
a.erase(a.begin() + i);
}
}
}
cout << a.size();
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1812 KiB | ||||
2 | Accepted | 3ms | 2004 KiB | ||||
subtask2 | 0/20 | ||||||
3 | Accepted | 6ms | 2368 KiB | ||||
4 | Time limit exceeded | 1.565s | 3288 KiB | ||||
5 | Time limit exceeded | 1.56s | 7072 KiB | ||||
6 | Time limit exceeded | 1.57s | 11000 KiB | ||||
7 | Time limit exceeded | 1.56s | 15144 KiB | ||||
8 | Time limit exceeded | 1.557s | 18952 KiB | ||||
9 | Time limit exceeded | 1.577s | 22876 KiB | ||||
10 | Time limit exceeded | 1.549s | 27060 KiB | ||||
11 | Time limit exceeded | 1.577s | 31096 KiB | ||||
subtask3 | 0/35 | ||||||
12 | Accepted | 3ms | 30492 KiB | ||||
13 | Wrong answer | 3ms | 30612 KiB | ||||
14 | Accepted | 3ms | 30824 KiB | ||||
15 | Wrong answer | 3ms | 31032 KiB | ||||
16 | Wrong answer | 3ms | 31152 KiB | ||||
17 | Wrong answer | 4ms | 31068 KiB | ||||
18 | Wrong answer | 3ms | 31184 KiB | ||||
19 | Wrong answer | 4ms | 31320 KiB | ||||
20 | Wrong answer | 4ms | 31556 KiB | ||||
subtask4 | 0/45 | ||||||
21 | Accepted | 7ms | 31928 KiB | ||||
22 | Time limit exceeded | 1.549s | 32776 KiB | ||||
23 | Time limit exceeded | 1.57s | 36700 KiB | ||||
24 | Time limit exceeded | 1.577s | 40340 KiB | ||||
25 | Time limit exceeded | 1.554s | 44352 KiB | ||||
26 | Time limit exceeded | 1.557s | 48108 KiB | ||||
27 | Time limit exceeded | 1.565s | 52080 KiB | ||||
28 | Time limit exceeded | 1.562s | 55844 KiB | ||||
29 | Time limit exceeded | 1.577s | 59680 KiB |