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