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 "highway.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN=9e4+5;
vector<int> g[MAXN], config;
vector<int> bons;
int aresta[MAXN*2][2];
int pid[MAXN], lvl[MAXN];
int n, m, x, y, tam;
void dfs(int cur, int pp, int d) {
//printf("%d %d %d\n", cur, pp, d);
pid[cur]=pp; lvl[cur]=d;
for(auto vid : g[cur]) {
if(vid==pp) continue;
int viz= aresta[vid][ aresta[vid][0]==cur ];
dfs(viz, vid, d+1);
}
}
void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
n=N; m=U.size(); x=A; y=B;
for(int i=0; i<m; i++) {
int a=U[i]; int b=V[i];
aresta[i][0]=a; aresta[i][1]=b;
g[a].push_back(i);
g[b].push_back(i);
config.push_back(0);
}
dfs(0, -1, 0);
tam=ask(config); tam/=x;
for(int i=0; i<n; i++) if(lvl[i]==tam) bons.push_back(i);
srand(0); random_shuffle(bons.begin(), bons.end());
for(auto cur : bons) {
config[pid[cur]]=1;
int val=ask(config);
if(val!=tam*x) answer(0, cur);
config[pid[cur]]=0;
}
}
# | 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... |