# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1072956 |
2024-08-24T07:49:41 Z |
Ignut |
Stations (IOI20_stations) |
C++17 |
|
617 ms |
936 KB |
// Ignut
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1111;
vector<int> tree[N];
vector<int> order;
void dfs(int v, int par) {
order.push_back(v);
for (int to : tree[v])
if (to != par)
dfs(to, v);
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
order.clear();
for (int i = 0; i < n; i ++) {
tree[i].clear();
}
for (int i = 0; i < n - 1; i ++) {
tree[u[i]].push_back(v[i]);
tree[v[i]].push_back(u[i]);
}
int start = 0;
for (int i = 0; i < n; i ++)
if (tree[i].size() == 1)
start = i;
dfs(start, -1);
vector<int> lbl(n);
for (int i = 0; i < n; i ++) lbl[order[i]] = i;
return lbl;
}
int find_next_station(int s, int t, vector<int> c) {
if (c.size() == 1)
return c[0];
int mn = min(c[0], c[1]);
int mx = max(c[0], c[1]);
if (s < t) return mx;
return mn;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
374 ms |
684 KB |
Output is correct |
2 |
Correct |
304 ms |
684 KB |
Output is correct |
3 |
Correct |
617 ms |
684 KB |
Output is correct |
4 |
Correct |
435 ms |
684 KB |
Output is correct |
5 |
Correct |
405 ms |
684 KB |
Output is correct |
6 |
Correct |
261 ms |
684 KB |
Output is correct |
7 |
Correct |
288 ms |
684 KB |
Output is correct |
8 |
Correct |
1 ms |
768 KB |
Output is correct |
9 |
Correct |
2 ms |
764 KB |
Output is correct |
10 |
Correct |
1 ms |
768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
327 ms |
680 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
357 ms |
684 KB |
Output is correct |
2 |
Correct |
280 ms |
916 KB |
Output is correct |
3 |
Correct |
597 ms |
784 KB |
Output is correct |
4 |
Correct |
440 ms |
684 KB |
Output is correct |
5 |
Correct |
430 ms |
684 KB |
Output is correct |
6 |
Correct |
272 ms |
684 KB |
Output is correct |
7 |
Correct |
315 ms |
684 KB |
Output is correct |
8 |
Correct |
2 ms |
764 KB |
Output is correct |
9 |
Correct |
1 ms |
768 KB |
Output is correct |
10 |
Correct |
0 ms |
768 KB |
Output is correct |
11 |
Incorrect |
406 ms |
684 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
594 ms |
684 KB |
Output is correct |
2 |
Correct |
483 ms |
936 KB |
Output is correct |
3 |
Correct |
465 ms |
684 KB |
Output is correct |
4 |
Correct |
1 ms |
768 KB |
Output is correct |
5 |
Correct |
1 ms |
768 KB |
Output is correct |
6 |
Correct |
0 ms |
776 KB |
Output is correct |
7 |
Incorrect |
433 ms |
684 KB |
Wrong query response. |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
366 ms |
684 KB |
Output is correct |
2 |
Correct |
282 ms |
684 KB |
Output is correct |
3 |
Correct |
616 ms |
936 KB |
Output is correct |
4 |
Correct |
489 ms |
684 KB |
Output is correct |
5 |
Correct |
347 ms |
684 KB |
Output is correct |
6 |
Correct |
272 ms |
684 KB |
Output is correct |
7 |
Correct |
329 ms |
684 KB |
Output is correct |
8 |
Correct |
1 ms |
768 KB |
Output is correct |
9 |
Correct |
1 ms |
776 KB |
Output is correct |
10 |
Correct |
0 ms |
768 KB |
Output is correct |
11 |
Incorrect |
304 ms |
688 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |