답안 #410075

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
410075 2021-05-22T00:30:40 Z dreezy 커다란 상품 (IOI17_prize) C++17
20 / 100
94 ms 328 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;

/*********************************************************************************************************************/

int find_best(int n) {
	
	int curtotal = -1;
	for(int i =0; i<10; i++){
		vector<int> res= ask(n/10 *i);
		if( !res[0] && !res[1]) return n/10 *i;
		curtotal = max(curtotal,res[0] +res[1]);
	}
	//cout <<":"<<curtotal<<endl;
	
	set<int> targets;
	for(int i =1; i<=curtotal; i++){
		targets.insert(i);
	}
	
	int left = 0, right = n-1;
	int target = *targets.begin();
	
	while(true){
		int ind = (left +right) /2 ;

		vector<int> res = ask(ind);
		
		if(res[0] + res[1] == 0)
			return ind;
		if(res[0] + res[1] < curtotal){
			ind++; 
			continue;
		}
		
		if(res[0] < target){
			left = ind +1;
		}
		else{
			right = ind - 1;
		}

	}
	
	return 0;
}


/*********************************************************************************************************************/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 276 KB Output is correct
2 Correct 1 ms 288 KB Output is correct
3 Correct 1 ms 284 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 1 ms 288 KB Output is correct
6 Correct 1 ms 280 KB Output is correct
7 Correct 1 ms 200 KB Output is correct
8 Correct 1 ms 280 KB Output is correct
9 Correct 1 ms 328 KB Output is correct
10 Correct 1 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 288 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 1 ms 200 KB Output is correct
6 Correct 1 ms 284 KB Output is correct
7 Correct 1 ms 200 KB Output is correct
8 Correct 1 ms 284 KB Output is correct
9 Correct 1 ms 200 KB Output is correct
10 Correct 1 ms 200 KB Output is correct
11 Incorrect 94 ms 284 KB Incorrect
12 Halted 0 ms 0 KB -