답안 #937845

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
937845 2024-03-04T15:19:55 Z Macker 커다란 상품 (IOI17_prize) C++14
20 / 100
54 ms 596 KB
#include "prize.h"
#include <bits/stdc++.h>

typedef long long ll;
#define all(v) v.begin(), v.end()
#define FOR(i, n) for (int i = 0; i < n; i++)

using namespace std;

int find_best(int n) {
	int mn = 0;
	FOR(i, min(500, n)){
		auto res = ask(i);
		mn = max(mn, res[0] + res[1]);
	}
	vector<int> pos;
	int l = 0, r = 1;
	FOR(i, mn){
		while(1){
			auto ret = ask(r);
			if(ret[0] + ret[1] != mn) break;
			if(ret[0] > i) break;
			r += (r - l); 
			if(r >= n){
				r = n - 1;
				break;
			}
		}
		while(l < r){
			int mid = (l + r) / 2;
			auto ret = ask(mid);
			if(ret[0] + ret[1] != mn) r = mid;
			else if(ret[0] > i) r = mid - 1;
			else l = mid + 1;
		}
		pos.push_back(l);
		if(r != n - 1) r++;
	}
	for (auto i : pos) {
		auto ret = ask(i);
		if(ret[0] + ret[1] == 0) return i;
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 2 ms 428 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 2 ms 344 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 2 ms 344 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 5 ms 344 KB Output is correct
12 Correct 5 ms 344 KB Output is correct
13 Correct 7 ms 344 KB Output is correct
14 Correct 9 ms 428 KB Output is correct
15 Partially correct 44 ms 440 KB Partially correct - number of queries: 8968
16 Partially correct 41 ms 436 KB Partially correct - number of queries: 9672
17 Partially correct 36 ms 436 KB Partially correct - number of queries: 9285
18 Partially correct 54 ms 436 KB Partially correct - number of queries: 9764
19 Partially correct 33 ms 424 KB Partially correct - number of queries: 8543
20 Partially correct 25 ms 436 KB Partially correct - number of queries: 6551
21 Partially correct 42 ms 424 KB Partially correct - number of queries: 9349
22 Partially correct 34 ms 412 KB Partially correct - number of queries: 7643
23 Correct 3 ms 344 KB Output is correct
24 Correct 7 ms 428 KB Output is correct
25 Incorrect 27 ms 596 KB answer is not correct
26 Halted 0 ms 0 KB -