# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
309914 | 2020-10-05T01:32:23 Z | tjdgus4384 | Stations (IOI20_stations) | C++14 | 1478 ms | 2097156 KB |
#include "stations.h" #include<bits/stdc++.h> using namespace std; vector<int> path[1001]; bool visited[1001]; int tsize[1001], lb[1001]; int dfs(int x){ int s = 1; for(int i = 0;i < path[x].size();i++){ if(visited[path[x][i]]) continue; visited[path[x][i]] = true; s += dfs(path[x][i]); } return tsize[x] = s; } void dfs2(int x, int s, int e, int d){ if(d%2 == 0) {lb[x] = s; s++;} else lb[x] = e; for(int i = 0;i < path[x].size();i++){ if(visited[path[x][i]]) continue; dfs2(path[x][i], s, s+tsize[path[x][i]]-1, d+1); s+=tsize[path[x][i]]; } } vector<int> label(int n, int k, vector<int> u, vector<int> v){ for(int i = 0;i < n-1;i++){ path[u[i]].push_back(v[i]); path[v[i]].push_back(u[i]); } visited[0] = true; dfs(0); for(int i = 0;i < n;i++) visited[i] = false; visited[0] = true; dfs2(0, 0, n-1, 0); vector<int> ret; for(int i = 0;i < n;i++) ret.push_back(lb[i]); return ret; } int find_next_station(int s, int t, vector<int> c){ if(c[0] < s){ if(t > s) return c[0]; c.push_back(1001); for(int i = 0;i < c.size() - 1;i++){ if(t >= c[i] && t < c[i+1]) return c[i]; } } else{ if(t < s) return c.back(); for(int i = 0;i < c.size();i++){ if(t <= c[i]) return c[i]; } return c.back(); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1478 ms | 2097156 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1297 ms | 2097152 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1266 ms | 2097156 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 864 ms | 1032 KB | Output is correct |
2 | Runtime error | 1271 ms | 2097156 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1289 ms | 2097156 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |