#include "popa.h"
#include <bits/stdc++.h>
using namespace std;
int solve(int n,int* lc,int* rc){
int par[1005];
for(int i=0;i<n;++i)par[i]=-1,lc[i]=-1,rc[i]=-1;
int cur=0;
for(int i=1;i<n;++i){
while(true){
if(query(0,i,0,cur)){
if(rc[cur]==-1){
par[i]=cur;
rc[cur]=i;
assert(0<=cur&&cur<n);
cur=i;
break;
}
else{
par[rc[cur]]=i;
lc[i]=rc[cur];
assert(0<=i&&i<n);
rc[cur]=i;
assert(0<=cur&&cur<n);
par[i]=cur;
cur=i;
break;
}
}
else{
if(par[cur]==-1){
lc[i]=cur;
assert(0<=i&&i<n);
par[cur]=i;
cur=i;
break;
}
else cur=par[cur];
}
}
}
while(par[cur]!=-1)cur=par[cur];
return cur;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
336 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
11 ms |
428 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5 ms |
416 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |