#include<bits/stdc++.h>
#include "popa.h"
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long
#define ii pair<int,int>
#define iii pair<ii,int>
#define sz(x) (x.size())
#define orta ((bas+son)>>1)
#define all(x) x.begin(),x.end()
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define pw(x) (1<<(x))
#define inf 2000500000
#define MOD 1000000007
//#define N 305
#define LOG 20
using namespace std;
int Solve(int bas,int son,int *Left,int *Right) {
int tut;
if(bas==son) {
Left[bas]=Right[bas]=-1;
return bas;
}
int L=Solve(orta+1,son,Left,Right);
int R=Solve(bas,orta,Left,Right);
if(query(bas,orta,bas,son)) {
tut=L;
while(1) {
if(Right[L]==-1) {
Right[L]=R;
break ;
}
L=Right[L];
}
}
else {
tut=R;
while(1) {
if(Left[R]==-1) {
Left[R]=L;
break ;
}
R=Left[R];
}
}
return tut;
}
int solve(int N, int* Left, int* Right) {
return Solve(0,N-1,Left,Right);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
not a valid solution |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
440 KB |
not a valid solution |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
15 ms |
440 KB |
not a valid solution |
2 |
Halted |
0 ms |
0 KB |
- |