# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
606065 |
2022-07-26T04:58:46 Z |
polya |
Stations (IOI20_stations) |
C++14 |
|
1057 ms |
620 KB |
#include "stations.h"
#define MAXN 1000
std::vector<int> adj[MAXN], labels;
void dfs(int v, int p, int d) {
labels[v] = d;
for (int i : adj[v]) if (i != p) dfs(i, v, d + 1);
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
for (int i = 0; i < n; i++) {
adj[i].clear();
}
for (int i = 0; i < n - 1; i++) {
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
labels.resize(n);
for (int i = 0; i < n; i++) {
if(adj[i].size() == 1) {
dfs(i, -1, 0);
return labels;
}
}
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
return s < t ? s + 1 : s - 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
500 ms |
520 KB |
Output is correct |
2 |
Correct |
453 ms |
520 KB |
Output is correct |
3 |
Correct |
872 ms |
516 KB |
Output is correct |
4 |
Correct |
832 ms |
512 KB |
Output is correct |
5 |
Correct |
637 ms |
516 KB |
Output is correct |
6 |
Correct |
492 ms |
544 KB |
Output is correct |
7 |
Correct |
471 ms |
516 KB |
Output is correct |
8 |
Correct |
2 ms |
492 KB |
Output is correct |
9 |
Correct |
4 ms |
492 KB |
Output is correct |
10 |
Correct |
1 ms |
492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
300 KB |
Invalid labels (duplicates values). scenario=0, label=10 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
576 ms |
572 KB |
Output is correct |
2 |
Correct |
447 ms |
516 KB |
Output is correct |
3 |
Correct |
939 ms |
416 KB |
Output is correct |
4 |
Correct |
817 ms |
416 KB |
Output is correct |
5 |
Correct |
614 ms |
516 KB |
Output is correct |
6 |
Correct |
525 ms |
516 KB |
Output is correct |
7 |
Correct |
522 ms |
512 KB |
Output is correct |
8 |
Correct |
3 ms |
484 KB |
Output is correct |
9 |
Correct |
5 ms |
420 KB |
Output is correct |
10 |
Correct |
2 ms |
492 KB |
Output is correct |
11 |
Incorrect |
1 ms |
208 KB |
Invalid labels (duplicates values). scenario=1, label=2 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1057 ms |
516 KB |
Output is correct |
2 |
Correct |
759 ms |
516 KB |
Output is correct |
3 |
Correct |
723 ms |
416 KB |
Output is correct |
4 |
Correct |
4 ms |
416 KB |
Output is correct |
5 |
Correct |
5 ms |
492 KB |
Output is correct |
6 |
Correct |
2 ms |
492 KB |
Output is correct |
7 |
Incorrect |
1 ms |
308 KB |
Invalid labels (duplicates values). scenario=0, label=2 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
614 ms |
504 KB |
Output is correct |
2 |
Correct |
551 ms |
620 KB |
Output is correct |
3 |
Correct |
971 ms |
492 KB |
Output is correct |
4 |
Correct |
645 ms |
416 KB |
Output is correct |
5 |
Correct |
703 ms |
520 KB |
Output is correct |
6 |
Correct |
512 ms |
568 KB |
Output is correct |
7 |
Correct |
524 ms |
544 KB |
Output is correct |
8 |
Correct |
2 ms |
500 KB |
Output is correct |
9 |
Correct |
7 ms |
496 KB |
Output is correct |
10 |
Correct |
2 ms |
468 KB |
Output is correct |
11 |
Incorrect |
8 ms |
336 KB |
Invalid labels (duplicates values). scenario=0, label=10 |
12 |
Halted |
0 ms |
0 KB |
- |