#include "popa.h"
#include <bits/stdc++.h>
using namespace std;
const int MN = 1005;
int i, cur, par[MN];
int solve(int N,int *L,int *R){
cur = 0;
for(i=0;i<N;i++)
par[i]=L[i]=R[i]=-1;
for(i=1;i<N;i++){
if(query(cur,i,i,i)){
if(par[cur]==-1){
L[i] = cur;
par[cur] = i;
cur = i;
}
else{
cur = par[cur];
i--;
}
}
else{
if(~R[cur]){
L[i]=R[cur];
par[L[i]]=i;
}
R[cur] = i;
par[i] = cur;
cur = i;
}
}
while(~par[cur]) cur=par[cur];
return cur;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
256 KB |
Output is correct |
2 |
Correct |
7 ms |
256 KB |
Output is correct |
3 |
Correct |
9 ms |
256 KB |
Output is correct |
4 |
Correct |
11 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
86 ms |
384 KB |
Output is correct |
2 |
Correct |
105 ms |
384 KB |
Output is correct |
3 |
Correct |
66 ms |
496 KB |
Output is correct |
4 |
Correct |
88 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
128 ms |
384 KB |
Output is correct |
2 |
Correct |
85 ms |
496 KB |
Output is correct |
3 |
Correct |
86 ms |
384 KB |
Output is correct |
4 |
Correct |
93 ms |
376 KB |
Output is correct |