# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
934104 | 2024-02-26T19:23:29 Z | EJIC_B_KEDAX | Stations (IOI20_stations) | C++17 | 538 ms | 1124 KB |
#include <bits/stdc++.h> using ll = long long; using namespace std; vector<vector<int>> g; vector<int> res; void dfs(int s, int p = -1, int d = 0) { if (~d & 1) { res.push_back(s); } for (int i : g[s]) { if (i != p) { dfs(i, s, d + 1); } } if (d & 1) { res.push_back(s); } } vector<int> label(int n, int k, vector<int> u, vector<int> v) { g.resize(n); for (int i = 0; i < n; i++) { g[i].clear(); } res.clear(); for (int i = 0; i < n - 1; i++) { g[u[i]].push_back(v[i]); g[v[i]].push_back(u[i]); } dfs(0); return res; } int find_next_station(int s, int t, vector<int> c) { if (c[0] > s) { if (t < s) { return c.back(); } for (int i = 0; i < c.size(); i++) { if (c[i] >= t) { return c[i]; } } return c.back(); } else { if (t > s) { return c[0]; } for (int i = c.size() - 1; i >= 0; i--) { if (c[i] <= t) { return c[i]; } } return c[0]; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 378 ms | 1124 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 252 ms | 864 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 305 ms | 940 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 538 ms | 856 KB | Output is correct |
2 | Correct | 403 ms | 684 KB | Output is correct |
3 | Incorrect | 409 ms | 684 KB | Wrong query response. |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 370 ms | 928 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |