# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
293642 | Dovran | Highway Tolls (IOI18_highway) | C++11 | 17 ms | 5888 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>
#include "highway.h"
#define N 200009
#define pii pair <int, int>
#define ff first
#define ss second
#define pb push_back
#define ll long long
using namespace std;
int n, m, l[N];
vector<int>e[N];
void f(int nd, int lv){
l[nd]=lv;
for(int i=0; i<e[nd].size(); i++)
if(!l[e[nd][i]] and e[nd][i]>0) f(e[nd][i], lv+1);
}
void find_pair(int NN, std::vector<int>u, std::vector<int>v, int a, int b){
n=NN;
m=u.size();
vector<int>asd;
for(int i=0; i<m; i++){
e[u[i]].pb(v[i]);
e[v[i]].pb(u[i]);
asd.pb(0);
}
if(a>b)
swap(a, b);
ll x=ask(asd);
x=x/a;
f(0, 0);
for(int i=0; i<n; i++){
if(l[i]==x){
answer(0, i);
return;
}
}
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |