6089 | 2023-10-29 17:52:11 | Ignác | Zsonglőrködés | cpp11 | Wrong answer 0/100 | 1.577s | 7172 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 = 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);
break;
}
}
}
cout << a.size();
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 3ms | 1812 KiB | ||||
2 | Accepted | 3ms | 2004 KiB | ||||
subtask2 | 0/20 | ||||||
3 | Accepted | 6ms | 2412 KiB | ||||
4 | Accepted | 1.044s | 4332 KiB | ||||
5 | Time limit exceeded | 1.557s | 4120 KiB | ||||
6 | Time limit exceeded | 1.565s | 4828 KiB | ||||
7 | Time limit exceeded | 1.549s | 5352 KiB | ||||
8 | Time limit exceeded | 1.565s | 5628 KiB | ||||
9 | Time limit exceeded | 1.541s | 5864 KiB | ||||
10 | Time limit exceeded | 1.557s | 6168 KiB | ||||
11 | Time limit exceeded | 1.57s | 6112 KiB | ||||
subtask3 | 0/35 | ||||||
12 | Accepted | 3ms | 3916 KiB | ||||
13 | Wrong answer | 3ms | 3948 KiB | ||||
14 | Wrong answer | 3ms | 4180 KiB | ||||
15 | Wrong answer | 3ms | 4256 KiB | ||||
16 | Wrong answer | 3ms | 4272 KiB | ||||
17 | Wrong answer | 3ms | 4156 KiB | ||||
18 | Wrong answer | 3ms | 4292 KiB | ||||
19 | Wrong answer | 3ms | 4372 KiB | ||||
20 | Wrong answer | 3ms | 4372 KiB | ||||
subtask4 | 0/45 | ||||||
21 | Accepted | 4ms | 4612 KiB | ||||
22 | Wrong answer | 958ms | 6312 KiB | ||||
23 | Time limit exceeded | 1.565s | 6360 KiB | ||||
24 | Time limit exceeded | 1.565s | 6920 KiB | ||||
25 | Time limit exceeded | 1.577s | 7160 KiB | ||||
26 | Time limit exceeded | 1.572s | 7116 KiB | ||||
27 | Time limit exceeded | 1.572s | 7160 KiB | ||||
28 | Time limit exceeded | 1.565s | 7172 KiB | ||||
29 | Time limit exceeded | 1.565s | 7164 KiB |