제출 #1366024

#제출 시각아이디문제언어결과실행 시간메모리
1366024akqxolotl커다란 상품 (IOI17_prize)C++20
20 / 100
17 ms1340 KiB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
//#define int long long
typedef pair<int,int> pii;
typedef vector<int> vi;
#define fi first
#define se second
#define debug(x) cerr<<#x<<" is "<<x<<endl;
#define sz(x) (int)(x).size()
#define pb push_back
#define ipii pair<int,pii>

int ans=-1;

void check(int l,int h){
	if(ans!=-1)return;
	bool f=1;
	if(l==h)f=0;
	int m=(l+h)/2;
	vi res=ask(m);
	if(res[0]==0){
		if(res[1]==0){
			ans=m;
			return;
		}else if(f)check(m,h);
	}else{
		if(f)check(l,m);
		if(res[1]>0&&f)check(m,h);
	}
}

int find_best(int n) {
	check(-1,n);
	//for(int i=0;i<30000;i++)ask(0);
	return ans;
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…