# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
362022 | 2021-02-01T14:51:38 Z | valerikk | Stations (IOI20_stations) | C++17 | 1055 ms | 1080 KB |
#include <bits/stdc++.h> using namespace std; const int N = 1000; vector<int> g[N]; int t = 0; vector<int> l; int dfs(int v, int p = -1) { l[v] = t++; int mx = l[v]; for (int u : g[v]) { if (u != p) mx = max(mx, dfs(u, v)); } l[v] *= N; l[v] += mx; return mx; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { for (int i = 0; i < n; i++) g[i].clear(); for (int i = 0; i < n - 1; i++) { g[u[i]].push_back(v[i]); g[v[i]].push_back(u[i]); } l.resize(n); dfs(0); return l; } int find_next_station(int s, int t, vector<int> c) { assert(s != t); int p; for (int v : c) { if (v / N <= s / N && s / N <= v % N) p = v; else { if (v / N <= t / N && t / N <= v % N) return v; } } return p; } #ifdef LOCAL int main(){ #ifdef LOCAL freopen("input.txt", "r", stdin); #endif ios::sync_with_stdio(false); cin.tie(0); return 0; } #endif
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 492 KB | Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=6009 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 364 KB | Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1511 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 492 KB | Invalid labels (values out of range). scenario=2, k=1000000, vertex=0, label=1000008 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 945 ms | 1080 KB | Output is correct |
2 | Correct | 713 ms | 864 KB | Output is correct |
3 | Correct | 649 ms | 952 KB | Output is correct |
4 | Correct | 3 ms | 864 KB | Output is correct |
5 | Correct | 5 ms | 952 KB | Output is correct |
6 | Correct | 1 ms | 736 KB | Output is correct |
7 | Correct | 756 ms | 864 KB | Output is correct |
8 | Correct | 1055 ms | 736 KB | Output is correct |
9 | Correct | 737 ms | 864 KB | Output is correct |
10 | Correct | 623 ms | 736 KB | Output is correct |
11 | Correct | 7 ms | 864 KB | Output is correct |
12 | Correct | 6 ms | 960 KB | Output is correct |
13 | Correct | 5 ms | 864 KB | Output is correct |
14 | Correct | 5 ms | 736 KB | Output is correct |
15 | Correct | 2 ms | 960 KB | Output is correct |
16 | Correct | 538 ms | 952 KB | Output is correct |
17 | Correct | 572 ms | 952 KB | Output is correct |
18 | Correct | 534 ms | 736 KB | Output is correct |
19 | Correct | 549 ms | 884 KB | Output is correct |
20 | Correct | 558 ms | 952 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 567 ms | 992 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |