# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1059454 | 2024-08-15T01:36:06 Z | ArthuroWich | Stations (IOI20_stations) | C++17 | 480 ms | 684 KB |
#include "stations.h" #include<bits/stdc++.h> using namespace std; vector<int> adj[1005]; int timer = 0, en[1005]; void dfs(int i, int p) { for (int j : adj[i]) { if (j == p) { continue; } dfs(j, i); } en[i] = timer; timer++; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { vector<int> labels(n); timer = 0; for (int i = 0; i <= n; i++) { adj[i].clear(); en[i] = 0; } int leaf = 0; for (int i = 0; i < n-1; i++) { adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } for (int i = 0; i < n; i++) { sort(adj[i].begin(), adj[i].end()); if (adj[i].size() == 1) { leaf = i; } } dfs(leaf, -1); for (int i = 0; i < n; i++) { labels[i] = en[i]; } return labels; } int find_next_station(int s, int t, vector<int> c) { if (c.back() < s) { for (int i : c) { if (t <= i) { return i; } } } int si = 0; si += c[0]+1; for (int i = 1; i < c.size(); i++) { s += c[i]-c[i-1]; } return c.back(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 317 ms | 684 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 229 ms | 684 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 276 ms | 684 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 480 ms | 684 KB | Output is correct |
2 | Incorrect | 367 ms | 684 KB | Wrong query response. |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 322 ms | 684 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |