제출 #936491

#제출 시각아이디문제언어결과실행 시간메모리
936491Ghetto커다란 상품 (IOI17_prize)C++17
20 / 100
1 ms544 KiB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;

int n;

int bin_search() {
	int lo = 0, hi = n - 1;
	while (lo != hi) {
		int mid = (lo + hi) / 2;
		vector<int> res = ask(mid);
		
		if (res[0] + res[1] == 0) return mid;
		else if (res[0] == 1) hi = mid - 1;
		else lo = mid + 1;
	}
	return lo;
}

int find_best(int tmp_n) {
	n = tmp_n;

	int ans = bin_search();
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...