제출 #1023928

#제출 시각아이디문제언어결과실행 시간메모리
1023928AndreyThe Big Prize (IOI17_prize)C++14
20 / 100
54 ms348 KiB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;

int ans = -1;

void calc(int l, int r) {
	if(l > r) {
		return;
	}
	int m = (l+r)/2;
	vector<int> haha = ask(m);
	if(haha[0]+haha[1] == 0) {
		ans = m;
		return;
	}
	if(l == r) {
		return;
	}
	if(haha[0] > 0 && ans == -1) {
		calc(l,m-1);
	}
	if(haha[1] > 0 && ans == -1) {
		calc(m+1,r);
	}
}

int find_best(int n) {
	calc(0,n-1);
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...