제출 #64451

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


vector<int> ans[200500];
int mx = -1;
int find(int l, int r){
	if(ans[l][0] == ans[r][0]){
		return 0;
	}
	int m = (l + r) >> 1, L = m, R = m + 1;
	while(l < L){
		ans[L] =ask(L);
		if(ans[L][0] + ans[L][1] == mx){
			break;
		}
		if(ans[L][0] + ans[L][1] == 0){
			return L;
		}
		L--;
	}
	while(r > R){
		ans[R] =ask(R);
		if(ans[R][0] + ans[R][1] == mx){
			break;
		}
		if(ans[R][0] + ans[R][1] == 0){
			return R;
		}
		R++;
	}
	return max(find(l, L), find(r, R));
}

int find_best(int n) {
  return 3;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...