# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
546769 | brunnorezendes | Stations (IOI20_stations) | C++14 | 6 ms | 760 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 "stations.h"
#include <bits/stdc++.h>
#define maxn 1001
using namespace std;
typedef vector <int> vi;
typedef vector <vi> vvi;
typedef pair <vi, int> vii;
vii dfs(int n, int x, vvi g, int pai, vi resp, int cont){
int i;
vii d;
for(i=0;i<g[x].size();i++){
if(g[x][i]!=pai){
d = dfs(n, g[x][i], g, x, resp, cont);
resp = d.first;
cont = d.second;
}
}
resp[x] = cont++;
return {resp, cont};
}
vi label(int n, int k, vi u, vi v){
vvi g = vvi(n);
vii retur;
vi resp = vi(n);
for(int i=0;i<u.size();i++){
g[u[i]].push_back(v[i]);
}
retur = dfs(n, 0, g, 0, resp, 0);
return retur.first;
}
int find_next_station(int s, int t, vi c){
int l=0, r=c.size()-1, mid;
while(r>l){
mid = (l+r)/2;
if(t<=c[mid]){
r = mid;
}
else l = mid+1;
}
return c[l];
}
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... |