# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
419150 | 2021-06-06T13:36:58 Z | NintsiChkhaidze | Stations (IOI20_stations) | C++14 | 871 ms | 528 KB |
#include "stations.h" #include <bits/stdc++.h> #define pb push_back using namespace std; vector <int> vec[1005]; int cnt,in[1005],out[1005],O[2005]; bool q=0; void dfs(int x,int p){ in[x] = ++cnt; for (int j=0;j<vec[x].size();j++){ int to = vec[x][j]; if (to == p) continue; dfs(to,x); } out[x] = cnt; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { q=0; if (k <= 1000000){ q=1; vector<int> labels; for (int i=0;i<n;i++) labels.pb(i); return labels; } vector<int> labels; for (int i=0;i<1001;i++){ O[i] = 0; vec[i].clear(); in[i] = out[i] = 0; } for (int i=0;i<u.size();i++){ vec[u[i]].pb(v[i]); vec[v[i]].pb(u[i]); } cnt=0; dfs(0,0); for (int i=0;i<n;i++) labels.pb(in[i]),O[in[i]] = out[i]; return labels; } int find_next_station(int s, int t, vector<int> c) { if (q){ if (c[0] == t) return t; if (c.size() > 1 && c[1] == t) return t; } int Ins = s,Int = t,Out = O[t]; if (Ins < Int){ for (int i=1;i<c.size();i++) if (Int >= c[i] && O[c[i]] >= Out) return c[i]; } return c[0]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 602 ms | 520 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 487 ms | 528 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 615 ms | 508 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 871 ms | 512 KB | Output is correct |
2 | Correct | 827 ms | 528 KB | Output is correct |
3 | Incorrect | 733 ms | 528 KB | Wrong query response. |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 610 ms | 528 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |