#include "highway.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define lo long long
#define inf 1000000009
#define md 1000000007
#define li 105
#define mp make_pair
#define pb push_back
#define mid (start+end)/2
using namespace std;
lo dep,dep2,aaa;
int baba[li],atakenar[li],tut;
vector< pair<int,int> > v[li];
vector<int> val,ol;
int yol[105];
void dfs(int node,int ata,lo int der){
baba[node]=ata;
if(der==dep) ol.pb(node);
for(int i=0;i<(int)v[node].size();i++){
int go=v[node][i].fi;
if(go==ata) continue;
atakenar[go]=v[node][i].se;
dfs(go,node,der+aaa);
}
}
void git(int a,int b){
while(b!=a){
yol[atakenar[b]]=1;
b=baba[b];
}
//yol.pb(a);
}
void find_pair(int N,vector<int> U,vector<int> V,int A,int B){
aaa=A;
for(int i=0;i<(int)U.size();i++){
v[U[i]].pb(mp(V[i],i));
v[V[i]].pb(mp(U[i],i));
}
for(int i=0;i<(int)U.size();i++) val.pb(0);
dep=ask(val);
val.clear();
for(int i=0;i<(int)U.size();i++) val.pb(1);
dep2=ask(val);
dfs(0,-1,0);
//val.clear();
for(int i=0;i<(int)ol.size();i++){
val.clear();
memset(yol,0,sizeof(yol));
git(0,ol[i]);
for(int j=0;j<(int)U.size();j++){
if(yol[j]==1) val.pb(1);
else val.pb(0);
}
if(ask(val)==dep2){
tut=ol[i];
break;
}
}
answer(0,tut);
}
//~ int main(){
//~ return 0;
//~ }
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
2 ms |
248 KB |
Output is correct |
5 |
Correct |
2 ms |
248 KB |
Output is correct |
6 |
Correct |
2 ms |
248 KB |
Output is correct |
7 |
Correct |
2 ms |
248 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
248 KB |
Output is correct |
10 |
Correct |
2 ms |
248 KB |
Output is correct |
11 |
Correct |
2 ms |
248 KB |
Output is correct |
12 |
Correct |
2 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
4 ms |
632 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
39 ms |
740 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
376 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
18 ms |
808 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
23 ms |
780 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |