# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
347256 | 2021-01-12T12:37:50 Z | blue | Stations (IOI20_stations) | C++17 | 907 ms | 1108 KB |
#include "stations.h" #include <iostream> #include <vector> using namespace std; vector<int> edge[1000]; vector<int> res(1000, -1); vector<int> visit(1000, 0); int dfs(int u, int a, bool flag) //return 1 + largest label yet created { visit[u] = 1; if(flag == 0) { res[u] = a; a++; } for(int v: edge[u]) { if(visit[v]) continue; a = dfs(v, a, !flag); } if(flag == 1) { 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]); } dfs(0, 0, 0); vector<int> temp(n); for(int i = 0; i < n; i++) temp[i] = res[i]; return temp; } 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 | 492 KB | Invalid labels (values out of range). scenario=2, k=1000, vertex=10, label=-1 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 492 KB | Invalid labels (values out of range). scenario=3, k=1000, vertex=996, label=-1 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 492 KB | Invalid labels (values out of range). scenario=1, k=1000000, vertex=2, label=-1 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 907 ms | 864 KB | Output is correct |
2 | Incorrect | 672 ms | 1108 KB | Wrong query response. |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 492 KB | Invalid labels (values out of range). scenario=1, k=1000000000, vertex=3, label=-1 |
2 | Halted | 0 ms | 0 KB | - |