# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
347252 | 2021-01-12T12:30:52 Z | blue | Stations (IOI20_stations) | C++17 | 831 ms | 1104 KB |
#include "stations.h" #include <iostream> #include <vector> using namespace std; vector<int> edge[1000]; vector<int> subtree(1000, 0); vector<int> res; int dfs(int u, int a, bool flag) //return 1 + largest label yet created { if(flag) { res[u] = a; a++; } for(int v: edge[u]) { if(res[v] != -1) continue; a = dfs(v, a, !flag); } if(!flag) { res[u] = a; a++; } return a; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { for(int i = 0; i < n-1; i++) { edge[u[i]].push_back(v[i]); edge[v[i]].push_back(u[i]); } res = vector<int>(n, -1); dfs(0, 0, 0); return res; } int find_next_station(int s, int t, vector<int> c) { if(s < c[0]) // s is a left label { if(t < s) return c.back(); for(int i = 0; i < c.size(); i++) if(t <= c[i]) return c[i]; } else //s is a right label { if(t > s) return c.front(); 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 | Incorrect | 3 ms | 608 KB | Invalid labels (values out of range). scenario=2, k=1000, vertex=0, label=1497 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 484 KB | Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=1650 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 543 ms | 1104 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 831 ms | 948 KB | Output is correct |
2 | Incorrect | 679 ms | 864 KB | Wrong query response. |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 499 ms | 1104 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |