# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
347254 | 2021-01-12T12:36:08 Z | blue | Stations (IOI20_stations) | C++17 | 4 ms | 620 KB |
#include "stations.h" #include <iostream> #include <vector> using namespace std; vector<int> edge[1000]; vector<int> res; 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]); } 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 | Runtime error | 2 ms | 620 KB | Execution killed with signal 6 (could be triggered by violating memory limits) |
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=1, k=1000, vertex=1, label=-1 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 620 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Invalid labels (values out of range). scenario=1, k=1000000000, vertex=1, 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=1000000000, vertex=1, label=-1 |
2 | Halted | 0 ms | 0 KB | - |