답안 #1030572

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1030572 2024-07-22T06:59:34 Z vjudge1 커다란 상품 (IOI17_prize) C++17
90 / 100
71 ms 11404 KB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rng(i,l,r) for(int i=(l); i<(r); i++)
#define all(x) x.begin(),x.end()
using ll=long long;
const int INF=INT_MAX>>1;

vector<vector<int>> answers(200010,{-1,-1});
int ret=-1;
vector<int> query(int n){
	if(answers[n][0]!=-1)return answers[n];
	vector<int> now=ask(n);
	if(now[0]+now[1]==0)ret=n;
	answers[n]=now;
	return now;
}

int find_best(int n) {
	int MAX_OTHERS=min(n-1,500);
	int candy=0;
	rep(i,MAX_OTHERS+1){
		vector<int> now=query(i);
		candy=max(candy,now[0]+now[1]);
	}
	int pos=MAX_OTHERS+1;
	while(pos<n){
		vector<int> now=query(pos);
		if(now[0]+now[1]!=candy){
			pos++;
			continue;
		}
		int ok=pos,ng=n;
		while(ng-ok>1){
			int mid=(ok+ng)>>1;
			vector<int> mnow=query(mid);
			if(mnow[0]+mnow[1]==candy&&mnow[0]==now[0]){
				ok=mid;
			}
			else{
				ng=mid;
			}
		}
		pos=ok+1;
	}
	return ret;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 11352 KB Output is correct
2 Correct 11 ms 11352 KB Output is correct
3 Correct 11 ms 11352 KB Output is correct
4 Correct 13 ms 11352 KB Output is correct
5 Correct 11 ms 11352 KB Output is correct
6 Correct 11 ms 11352 KB Output is correct
7 Correct 10 ms 11352 KB Output is correct
8 Correct 11 ms 11352 KB Output is correct
9 Correct 11 ms 11352 KB Output is correct
10 Correct 11 ms 11352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 11352 KB Output is correct
2 Correct 12 ms 11352 KB Output is correct
3 Correct 10 ms 11348 KB Output is correct
4 Correct 12 ms 11352 KB Output is correct
5 Correct 9 ms 11348 KB Output is correct
6 Correct 9 ms 11352 KB Output is correct
7 Correct 13 ms 11352 KB Output is correct
8 Correct 11 ms 11404 KB Output is correct
9 Correct 10 ms 11348 KB Output is correct
10 Correct 10 ms 11352 KB Output is correct
11 Correct 17 ms 11352 KB Output is correct
12 Correct 13 ms 11352 KB Output is correct
13 Correct 13 ms 11352 KB Output is correct
14 Correct 18 ms 11352 KB Output is correct
15 Partially correct 44 ms 11352 KB Partially correct - number of queries: 7987
16 Partially correct 51 ms 11352 KB Partially correct - number of queries: 8407
17 Partially correct 54 ms 11352 KB Partially correct - number of queries: 8378
18 Partially correct 45 ms 11352 KB Partially correct - number of queries: 8379
19 Partially correct 39 ms 11352 KB Partially correct - number of queries: 7901
20 Partially correct 43 ms 11348 KB Partially correct - number of queries: 5613
21 Partially correct 40 ms 11352 KB Partially correct - number of queries: 8296
22 Partially correct 42 ms 11352 KB Partially correct - number of queries: 6311
23 Correct 11 ms 11352 KB Output is correct
24 Correct 13 ms 11372 KB Output is correct
25 Partially correct 50 ms 11352 KB Partially correct - number of queries: 8294
26 Partially correct 56 ms 11352 KB Partially correct - number of queries: 8230
27 Correct 10 ms 11352 KB Output is correct
28 Partially correct 46 ms 11352 KB Partially correct - number of queries: 8185
29 Partially correct 37 ms 11352 KB Partially correct - number of queries: 6772
30 Partially correct 47 ms 11352 KB Partially correct - number of queries: 8337
31 Partially correct 54 ms 11352 KB Partially correct - number of queries: 8351
32 Correct 14 ms 11352 KB Output is correct
33 Correct 9 ms 11352 KB Output is correct
34 Partially correct 71 ms 11400 KB Partially correct - number of queries: 8375
35 Correct 12 ms 11352 KB Output is correct
36 Partially correct 52 ms 11352 KB Partially correct - number of queries: 8278
37 Correct 14 ms 11352 KB Output is correct
38 Correct 13 ms 11352 KB Output is correct
39 Partially correct 43 ms 11352 KB Partially correct - number of queries: 8320
40 Partially correct 38 ms 11352 KB Partially correct - number of queries: 7222
41 Partially correct 66 ms 11352 KB Partially correct - number of queries: 8243
42 Partially correct 47 ms 11352 KB Partially correct - number of queries: 8243
43 Partially correct 55 ms 11352 KB Partially correct - number of queries: 7849
44 Partially correct 55 ms 11352 KB Partially correct - number of queries: 8370
45 Partially correct 60 ms 11348 KB Partially correct - number of queries: 8307
46 Partially correct 58 ms 11352 KB Partially correct - number of queries: 8369
47 Partially correct 44 ms 11352 KB Partially correct - number of queries: 8374
48 Partially correct 39 ms 11352 KB Partially correct - number of queries: 8377
49 Partially correct 40 ms 11352 KB Partially correct - number of queries: 8340
50 Partially correct 46 ms 11352 KB Partially correct - number of queries: 8381
51 Partially correct 46 ms 11352 KB Partially correct - number of queries: 8340
52 Partially correct 48 ms 11352 KB Partially correct - number of queries: 8408
53 Correct 11 ms 11352 KB Output is correct
54 Partially correct 52 ms 11352 KB Partially correct - number of queries: 8315
55 Partially correct 59 ms 11352 KB Partially correct - number of queries: 8390
56 Partially correct 55 ms 11352 KB Partially correct - number of queries: 8381
57 Partially correct 59 ms 11352 KB Partially correct - number of queries: 8326
58 Partially correct 49 ms 11352 KB Partially correct - number of queries: 8354
59 Partially correct 52 ms 11352 KB Partially correct - number of queries: 8234
60 Partially correct 45 ms 11352 KB Partially correct - number of queries: 7884
61 Correct 13 ms 11352 KB Output is correct
62 Correct 11 ms 11352 KB Output is correct
63 Correct 11 ms 11352 KB Output is correct
64 Correct 12 ms 11352 KB Output is correct
65 Correct 11 ms 11352 KB Output is correct
66 Correct 18 ms 11352 KB Output is correct
67 Correct 14 ms 11352 KB Output is correct
68 Correct 11 ms 11352 KB Output is correct
69 Correct 13 ms 11352 KB Output is correct
70 Correct 11 ms 11348 KB Output is correct
71 Partially correct 50 ms 11352 KB Partially correct - number of queries: 8266
72 Correct 13 ms 11352 KB Output is correct
73 Partially correct 48 ms 11352 KB Partially correct - number of queries: 8159
74 Partially correct 49 ms 11352 KB Partially correct - number of queries: 8214
75 Correct 11 ms 11352 KB Output is correct
76 Partially correct 33 ms 11348 KB Partially correct - number of queries: 7143
77 Partially correct 56 ms 11352 KB Partially correct - number of queries: 8410
78 Correct 14 ms 11352 KB Output is correct
79 Correct 28 ms 11348 KB Output is correct
80 Partially correct 48 ms 11352 KB Partially correct - number of queries: 8437
81 Partially correct 47 ms 11352 KB Partially correct - number of queries: 8390
82 Partially correct 51 ms 11352 KB Partially correct - number of queries: 8346
83 Correct 11 ms 11352 KB Output is correct
84 Partially correct 46 ms 11352 KB Partially correct - number of queries: 6944
85 Partially correct 58 ms 11352 KB Partially correct - number of queries: 8376
86 Correct 10 ms 11352 KB Output is correct
87 Correct 10 ms 11352 KB Output is correct
88 Correct 11 ms 11352 KB Output is correct
89 Correct 12 ms 11352 KB Output is correct
90 Correct 11 ms 11352 KB Output is correct
91 Correct 11 ms 11352 KB Output is correct
92 Correct 11 ms 11352 KB Output is correct
93 Correct 13 ms 11352 KB Output is correct
94 Correct 16 ms 11276 KB Output is correct
95 Correct 13 ms 11352 KB Output is correct
96 Correct 11 ms 11352 KB Output is correct
97 Correct 17 ms 11352 KB Output is correct