# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
322068 | 2020-11-14T01:57:18 Z | gurkot | Stations (IOI20_stations) | C++14 | 830 ms | 1232 KB |
#include "stations.h" #include <vector> #include <iostream> using namespace std; int fix[1000],lab[1000],timer,lev; vector <int> gr[1000]; void dfs(int u){ fix[u]=1; lev++; if((lev&1)==0) lab[u]=timer++; for(int i=0;i<gr[u].size();i++) if(fix[gr[u][i]]==0) dfs(gr[u][i]); if((lev&1)==1) lab[u]=timer++; lev--; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { vector <int> labels; labels.resize(n); for(int i=0;i<n;i++) { gr[i].clear(); lab[i]=fix[i]=0; } for (int i=0; i<(int)u.size(); i++) { gr[u[i]].push_back(v[i]); gr[v[i]].push_back(u[i]); } timer=0; lev=-1; dfs(0); for(int i=0;i<n;i++) labels[i]=lab[i]; return labels; } int find_next_station(int s, int t, vector<int> c) { if(s<c[0]) { if(t>s) for(int i=0;i<(int)c.size()-1;i++) if(t<=c[i]) return c[i]; return c[c.size()-1]; } else { for(int i=(int)c.size()-1;i>=1;i--) if(t>=c[i]) return c[i]; return c[0]; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 543 ms | 1232 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 445 ms | 1008 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 522 ms | 1120 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 827 ms | 896 KB | Output is correct |
2 | Correct | 830 ms | 992 KB | Output is correct |
3 | Incorrect | 762 ms | 944 KB | Wrong query response. |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 559 ms | 1104 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |