Submission #1211455

#TimeUsernameProblemLanguageResultExecution timeMemory
1211455repsak커다란 상품 (IOI17_prize)C++20
20 / 100
0 ms408 KiB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;

map<int, vector<int>> info; // {6 : [1, 3, 5], 5 : [6, 4] ...}

int binary(int left, int right, int sumA, int index){

	while(left < right){
		int mid = (left + right) / 2;

		vector<int> res = ask(mid);
		int l = res[0]; int r = res[1];
		int sum = res[0] + res[1];
		
		if(sum < sumA) return mid;
		// Some condition depending on; sum, sumA

		if(l < index){
			left = mid + 1;
		}else{
			right = mid;
		}
	}

	return left;
}


int find_best(int n) {
	return binary(0, n - 1, 1, 1);
	// for(int i = 0; i < n; i++) {
	// 	vector<int> res = ask(i);
	// 	if(res[0] + res[1] == 0)
	// 		return i;
	// }
	// return 0;
}

// #include "grader.cpp"
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...