제출 #55047

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

int find_best(int n) {
	int lo = 0, hi = n - 1;
	int last = INT_MAX;
	while (1) {
		int mid = (lo + hi) / 2;
		vector<int> tmp = ask(mid);
		if (tmp[0] + tmp[1] == 0) {
			return mid;
		}
		if (tmp[0] + tmp[1] < last) {
			last = tmp[0] + tmp[1];
			lo = 0, hi = n - 1;
		}
		if (tmp[0] > tmp[1]) {
			hi = mid - 1;
		} else {
			lo = mid + 1;
		}
	}
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...