답안 #1030570

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1030570 2024-07-22T06:58:30 Z vjudge1 커다란 상품 (IOI17_prize) C++17
20 / 100
71 ms 11604 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,470);
	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 11 ms 11248 KB Output is correct
2 Correct 11 ms 11352 KB Output is correct
3 Correct 11 ms 11352 KB Output is correct
4 Correct 11 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 9 ms 11352 KB Output is correct
8 Correct 15 ms 11352 KB Output is correct
9 Correct 11 ms 11352 KB Output is correct
10 Correct 16 ms 11352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 11352 KB Output is correct
2 Correct 16 ms 11352 KB Output is correct
3 Correct 16 ms 11352 KB Output is correct
4 Correct 11 ms 11352 KB Output is correct
5 Correct 11 ms 11352 KB Output is correct
6 Correct 8 ms 11352 KB Output is correct
7 Correct 9 ms 11348 KB Output is correct
8 Correct 16 ms 11352 KB Output is correct
9 Correct 10 ms 11352 KB Output is correct
10 Correct 9 ms 11352 KB Output is correct
11 Correct 16 ms 11352 KB Output is correct
12 Correct 12 ms 11352 KB Output is correct
13 Correct 16 ms 11352 KB Output is correct
14 Correct 24 ms 11352 KB Output is correct
15 Partially correct 55 ms 11352 KB Partially correct - number of queries: 7957
16 Partially correct 53 ms 11352 KB Partially correct - number of queries: 8378
17 Partially correct 49 ms 11352 KB Partially correct - number of queries: 8349
18 Partially correct 42 ms 11352 KB Partially correct - number of queries: 8350
19 Partially correct 33 ms 11352 KB Partially correct - number of queries: 7870
20 Partially correct 31 ms 11352 KB Partially correct - number of queries: 5583
21 Partially correct 49 ms 11352 KB Partially correct - number of queries: 8266
22 Partially correct 38 ms 11352 KB Partially correct - number of queries: 6280
23 Correct 11 ms 11352 KB Output is correct
24 Correct 12 ms 11352 KB Output is correct
25 Partially correct 43 ms 11352 KB Partially correct - number of queries: 8262
26 Partially correct 60 ms 11352 KB Partially correct - number of queries: 8199
27 Correct 16 ms 11352 KB Output is correct
28 Partially correct 41 ms 11376 KB Partially correct - number of queries: 8154
29 Partially correct 39 ms 11352 KB Partially correct - number of queries: 6743
30 Partially correct 54 ms 11156 KB Partially correct - number of queries: 8307
31 Partially correct 54 ms 11604 KB Partially correct - number of queries: 8321
32 Correct 11 ms 11352 KB Output is correct
33 Correct 8 ms 11352 KB Output is correct
34 Partially correct 58 ms 11400 KB Partially correct - number of queries: 8345
35 Correct 10 ms 11352 KB Output is correct
36 Partially correct 49 ms 11352 KB Partially correct - number of queries: 8248
37 Correct 12 ms 11352 KB Output is correct
38 Correct 11 ms 11352 KB Output is correct
39 Partially correct 71 ms 11352 KB Partially correct - number of queries: 8290
40 Partially correct 43 ms 11352 KB Partially correct - number of queries: 7207
41 Partially correct 50 ms 11604 KB Partially correct - number of queries: 8213
42 Partially correct 54 ms 11352 KB Partially correct - number of queries: 8213
43 Partially correct 39 ms 11352 KB Partially correct - number of queries: 7820
44 Partially correct 51 ms 11352 KB Partially correct - number of queries: 8340
45 Partially correct 56 ms 11352 KB Partially correct - number of queries: 8277
46 Partially correct 56 ms 11352 KB Partially correct - number of queries: 8340
47 Partially correct 66 ms 11352 KB Partially correct - number of queries: 8343
48 Partially correct 54 ms 11352 KB Partially correct - number of queries: 8348
49 Partially correct 71 ms 11400 KB Partially correct - number of queries: 8309
50 Partially correct 42 ms 11348 KB Partially correct - number of queries: 8352
51 Partially correct 52 ms 11352 KB Partially correct - number of queries: 8310
52 Partially correct 49 ms 11352 KB Partially correct - number of queries: 8379
53 Correct 11 ms 11352 KB Output is correct
54 Partially correct 41 ms 11352 KB Partially correct - number of queries: 8286
55 Partially correct 58 ms 11352 KB Partially correct - number of queries: 8361
56 Partially correct 51 ms 11352 KB Partially correct - number of queries: 8352
57 Partially correct 66 ms 11352 KB Partially correct - number of queries: 8294
58 Partially correct 44 ms 11352 KB Partially correct - number of queries: 8324
59 Partially correct 62 ms 11352 KB Partially correct - number of queries: 8204
60 Partially correct 61 ms 11352 KB Partially correct - number of queries: 7856
61 Correct 11 ms 11352 KB Output is correct
62 Correct 11 ms 11348 KB Output is correct
63 Correct 12 ms 11352 KB Output is correct
64 Correct 11 ms 11352 KB Output is correct
65 Correct 10 ms 11352 KB Output is correct
66 Correct 13 ms 11352 KB Output is correct
67 Correct 17 ms 11352 KB Output is correct
68 Correct 11 ms 11352 KB Output is correct
69 Correct 11 ms 11352 KB Output is correct
70 Correct 12 ms 11352 KB Output is correct
71 Partially correct 49 ms 11352 KB Partially correct - number of queries: 8223
72 Correct 17 ms 11352 KB Output is correct
73 Partially correct 54 ms 11352 KB Partially correct - number of queries: 8117
74 Partially correct 59 ms 11348 KB Partially correct - number of queries: 8175
75 Correct 11 ms 11352 KB Output is correct
76 Partially correct 48 ms 11352 KB Partially correct - number of queries: 7107
77 Partially correct 44 ms 11352 KB Partially correct - number of queries: 8409
78 Correct 17 ms 11352 KB Output is correct
79 Correct 21 ms 11348 KB Output is correct
80 Partially correct 60 ms 11352 KB Partially correct - number of queries: 8405
81 Partially correct 64 ms 11352 KB Partially correct - number of queries: 8426
82 Partially correct 66 ms 11352 KB Partially correct - number of queries: 8289
83 Correct 11 ms 11352 KB Output is correct
84 Partially correct 45 ms 11352 KB Partially correct - number of queries: 6925
85 Partially correct 67 ms 11604 KB Partially correct - number of queries: 8371
86 Incorrect 58 ms 11352 KB Incorrect
87 Halted 0 ms 0 KB -