#include "highway.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi> vpi;
#define mp make_pair
#define pb emplace_back
#define f first
#define s second
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
vpi V[100100];
int sub[100100];
vi q;
pi par[100100];
int rt;
int ind;
vi top;
void dfs(int x, int p){
top.pb(x);
for (auto v:V[x])if (v.f!=p){
par[v.f] = mp(x, v.s);
dfs(v.f,x);
}
}
void find_pair(int N, std::vector<int> U, std::vector<int> _V, int A, int B) {
int M = U.size();
q.resize(N-1,0);
for (int i=0;i<M;++i){
int a=_V[i];
int b=U[i];
V[a].pb(b,i);
V[b].pb(a,i);
}
ll len=ask(q);
dfs(0,-1);
for (auto i : top){
for(int j=0;j<N-1;++j)q[i]=0;
int x=i;
while(x){
q[par[x].s]=1;
x=par[x].f;
}
// for (int i=0;i<N-1;++i)cout<<q[i]<<' ';cout<<'\n';
ll l = ask(q);
// cout<<l<<' '<<len<<'\n';
if ((ll)len*(ll)B == (ll)l*(ll)A){
answer(0,i);
return;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
2684 KB |
Output is correct |
2 |
Correct |
5 ms |
2684 KB |
Output is correct |
3 |
Runtime error |
9 ms |
5244 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
2728 KB |
Output is incorrect: more than 100 calls to ask. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
3832 KB |
Output is incorrect: more than 100 calls to ask. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
2728 KB |
Output is incorrect: more than 100 calls to ask. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
3264 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
3260 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |