# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
497665 | 2021-12-23T13:30:24 Z | Hanksburger | Stations (IOI20_stations) | C++17 | 2328 ms | 2097156 KB |
#include "stations.h" #include <bits/stdc++.h> using namespace std; vector<int> adj[1005], ans; int dfs(int U, int P, int cnt, bool X) { if (X) { ans[U]=cnt; cnt++; for (int i=0; i<adj[U].size(); i++) { int V=adj[U][i]; if (V!=P) cnt=dfs(V, U, cnt, 0); } } else { for (int i=0; i<adj[U].size(); i++) { int V=adj[U][i]; if (V!=P) cnt=dfs(V, U, cnt, 1); } ans[U]=cnt; cnt++; } return cnt; } vector<int> label(int N, int K, vector<int> U, vector<int> V) { 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++) ans.push_back(0); dfs(0, -1, 0, 1); return ans; } int find_next_station(int S, int T, vector<int> C) { if (S<C[0]) { int P=C[C.size()-1]; if (T<S || T>=P) return P; for (int i=0; i<C.size(); i++) if (T<=C[i]) return C[i]; } else { int P=C[0]; if (T<=P || T>S) return P; for (int i=C.size()-1; i>=0; i--) if (T>=C[i]) return C[i]; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1363 ms | 2097156 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 328 KB | Invalid length of array as the response of 'label'. scenario=1, n=994, len=1990 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1235 ms | 2097156 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 200 KB | Invalid length of array as the response of 'label'. scenario=1, n=2, len=4 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2328 ms | 2097156 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |