# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
939983 | 2024-03-07T03:20:03 Z | Warinchai | Stations (IOI20_stations) | C++14 | 543 ms | 972 KB |
#include "stations.h" #include <vector> #include<bits/stdc++.h> using namespace std; vector<int>adj[1005]; int ar[1005]; int in[1005]; int out[1005]; int cur=-1; int rv[1005]; void dfs(int u,int p=-1){ in[u]=++cur; rv[cur]=u; for(auto x:adj[u])if(x!=p)dfs(x,u); out[u]=cur; } vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { vector<int>ans; for(int i=0;i<=n;i++)adj[i].clear(); for(int i=0;i<n-1;i++)adj[u[i]].push_back(v[i]),adj[v[i]].push_back(u[i]); dfs(0); for(int i=0;i<n;i++)ans.push_back(in[i]); //for(int i=0;i<n;i++)cerr<<in[i]<<"\n"; return ans; } int find_next_station(int s, int t, std::vector<int> c) { if(t<=c[0])return c[0]; c.push_back(out[rv[s]]+1); for(int i=1;i<c.size()-1;i++)if(t>=c[i]&&t<c[i+1])return c[i]; return c[0]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 824 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 536 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 840 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 543 ms | 800 KB | Output is correct |
2 | Incorrect | 355 ms | 972 KB | Wrong query response. |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 840 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |