답안 #63033

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
63033 2018-07-31T11:12:28 Z hamzqq9 popa (BOI18_popa) C++14
0 / 100
12 ms 516 KB
#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 R=Solve(orta+1,son,Left,Right);
	int L=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 4 ms 252 KB not a valid solution
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 12 ms 436 KB not a valid solution
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 516 KB not a valid solution
2 Halted 0 ms 0 KB -