# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
537935 | 2022-03-15T22:20:49 Z | groshi | Stations (IOI20_stations) | C++17 | 802 ms | 676 KB |
#include<iostream> #include<vector> #include<algorithm> #include<stations.h> using namespace std; int kiedy=0,kiedy2=0; int odw[1010]; vector<int> Q[1010]; int moj_koniec[2000]; int bylam[2000]; void dfs(int x) { odw[x]=kiedy; kiedy++; bylam[x]=1; for(int i=0;i<Q[x].size();i++) { int pom=Q[x][i]; if(bylam[pom]!=0) continue; dfs(pom); } moj_koniec[odw[x]]=kiedy2; kiedy2++; } vector<int> label(int n,int k,vector<int> u,vector<int> v) { for(int i=0;i<=n+3;i++) { odw[i]=0; moj_koniec[i]=0; bylam[i]=0; } for(int i=0;i<=n+3;i++) Q[i].clear(); kiedy=0; kiedy2=0; for(int i=0;i<u.size();i++) { u[i]++; v[i]++; Q[u[i]].push_back(v[i]); Q[v[i]].push_back(u[i]); } dfs(1); vector<int> wypisz; for(int i=1;i<=n;i++) wypisz.push_back(odw[i]); return wypisz; } int find_next_station(int s,int t,vector<int> c) { sort(c.begin(),c.end()); if(t<s) return c[0]; if(moj_koniec[t]>moj_koniec[s]) return c[0]; for(int i=1;i<c.size();i++) { if(t>=c[i] && moj_koniec[t]<=moj_koniec[c[i]]) return c[i]; } return c[0]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 459 ms | 544 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 403 ms | 620 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 500 ms | 656 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 802 ms | 660 KB | Output is correct |
2 | Correct | 563 ms | 676 KB | Output is correct |
3 | Incorrect | 501 ms | 416 KB | Wrong query response. |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 451 ms | 660 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |