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"
using namespace std;
long long ask(const std::vector<int> &w);
void answer(int s, int t);
int m;
long long dist;
long long should;
map<pair<int,int>,int>id;
vector<int>adj[(int)9e4+5];
bool check(int i) {
vector<int>A(m,0);
A[i] = 1;
if(ask(A) != should)
return 1;
return 0;
}
void dfs(int u, int d, int e = -1) {
if(d == 1) {
for(auto z : adj[u]) if(z != e) {
if(check(id[{u,z}]))
answer(0, z);
}
return;
}
for(auto z : adj[u]) if(z != e) {
dfs(z, d-1, u);
}
}
void find_pair(int n, vector<int>u, vector<int>v, int a, int b) {
m = (int)u.size();
vector<int>A((int)u.size());
dist = ask(A) / a;
should = dist * a;
for(int i = 0 ; i < m ; i++)
adj[u[i]].push_back(v[i]), adj[v[i]].push_back(u[i]), id[{u[i],v[i]}] = id[{v[i], u[i]}] = i;
dfs(0, dist);
}
# | 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... |