# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
795776 | alexander707070 | Stations (IOI20_stations) | C++14 | 672 ms | 676 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define MAXN 1007
using namespace std;
int n;
vector<int> sol,v[MAXN];
int tim,num[MAXN];
void dfs(int x,int p,int dep){
num[x]=tim; tim++;
for(int i=0;i<v[x].size();i++){
if(v[x][i]!=p)dfs(v[x][i],x,dep+1);
}
sol[x]=num[x];
}
vector<int> label(int N, int k,vector<int> from,vector<int> to){
n=N;
sol.resize(n);
for(int i=0;i<n;i++)v[i].clear();
tim=0;
for(int i=0;i<n-1;i++){
v[from[i]].push_back(to[i]);
v[to[i]].push_back(from[i]);
}
dfs(0,-1,0);
return sol;
}
int find_next_station(int s, int t,vector<int> c){
if(t>s and c[0]>s)return c[0];
else if(t>s)return c[1];
if(t<s and c[0]<s)return c[0];
else if(t<s)return c[1];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |