# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
304932 | 2020-09-22T08:39:02 Z | Wu_Ren | Stations (IOI20_stations) | C++14 | 1083 ms | 916 KB |
#include "stations.h" #include <bits/stdc++.h> using namespace std; vector<int>labels; int head[1010],o,cnt; struct edge{ int to,link; }e[2010]; void add_edge(int u,int v){ e[++o].to=v,e[o].link=head[u],head[u]=o; e[++o].to=u,e[o].link=head[v],head[v]=o; } void dfs(int u,int pre,int dep){ if(dep&1) labels[u]=cnt++; for(int i=head[u];i;i=e[i].link){ if(e[i].to==pre) continue; dfs(e[i].to,u,dep+1); } if(!(dep&1)) labels[u]=cnt++; } vector<int> label(int n,int k,vector<int>u,vector<int>v){ for(int i=0;i<n;i++) head[i]=0;cnt=o=0; labels.resize(n); for(int i=0;i<n-1;i++) add_edge(u[i],v[i]); dfs(0,-1,1); return labels; } int find_next_station(int s,int t,vector<int>c) { if(s<c[0]){ if(t<s) return c[c.size()-1]; if(t>=c[c.size()-1]) return c[c.size()-1]; for(int i=0;i<(int)c.size();i++) if(t<=c[i]) return c[i]; } else{ if(t>s) return c[0]; if(t<c[1]) return c[0]; 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 | 662 ms | 896 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 482 ms | 768 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 637 ms | 832 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1027 ms | 776 KB | Output is correct |
2 | Correct | 1083 ms | 916 KB | Output is correct |
3 | Incorrect | 769 ms | 760 KB | Wrong query response. |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 634 ms | 768 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |