답안 #348312

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
348312 2021-01-14T15:01:36 Z jamielim 커다란 상품 (IOI17_prize) C++14
90 / 100
104 ms 2028 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;

pair<int,int> memo[200005];

pair<int,int> qry(int x){
	if(memo[x].first!=-1)return memo[x];
	vector<int> v=ask(x);
	return memo[x]=make_pair(v[0],v[1]);
}

int find_best(int n){
	for(int i=0;i<n;i++)memo[i]=make_pair(-1,-1);
	int k=1;
	while(k*(k+1)<n)k++;
	k++;
	int sz=0;
	pair<int,int> p;
	for(int i=0;i<k;i++){
		p=qry(n/k*i);
		sz=max(sz,p.first+p.second);
	}
	for(int i=0;i<n;i++){
		p=qry(i);
		if(p.first+p.second==0)return i;
		if(p.first+p.second!=sz)continue;
		int l=i,r=n-1,mid;
		while(l<r){
			mid=(l+r+1)/2;
			if(qry(mid)==p){
				l=mid;
			}else{
				r=mid-1;
			}
		}
		i=l;
	}
	return n;
}
/*
8
3 2 3 1 3 3 2 3
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1900 KB Output is correct
2 Correct 6 ms 1900 KB Output is correct
3 Correct 6 ms 1900 KB Output is correct
4 Correct 5 ms 1900 KB Output is correct
5 Correct 11 ms 1900 KB Output is correct
6 Correct 7 ms 1900 KB Output is correct
7 Correct 9 ms 1900 KB Output is correct
8 Correct 8 ms 1920 KB Output is correct
9 Correct 6 ms 1900 KB Output is correct
10 Correct 8 ms 1900 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1900 KB Output is correct
2 Correct 5 ms 1900 KB Output is correct
3 Correct 8 ms 1900 KB Output is correct
4 Correct 7 ms 1900 KB Output is correct
5 Correct 8 ms 1900 KB Output is correct
6 Correct 7 ms 1900 KB Output is correct
7 Correct 7 ms 1912 KB Output is correct
8 Correct 6 ms 1900 KB Output is correct
9 Correct 6 ms 1900 KB Output is correct
10 Correct 5 ms 1900 KB Output is correct
11 Correct 9 ms 1900 KB Output is correct
12 Correct 4 ms 1900 KB Output is correct
13 Correct 13 ms 1900 KB Output is correct
14 Correct 4 ms 492 KB Output is correct
15 Correct 21 ms 1912 KB Output is correct
16 Partially correct 70 ms 1900 KB Partially correct - number of queries: 7178
17 Correct 6 ms 1900 KB Output is correct
18 Partially correct 104 ms 1900 KB Partially correct - number of queries: 8315
19 Correct 8 ms 1900 KB Output is correct
20 Correct 34 ms 1132 KB Output is correct
21 Correct 33 ms 1900 KB Output is correct
22 Correct 15 ms 1900 KB Output is correct
23 Correct 7 ms 1900 KB Output is correct
24 Correct 10 ms 1900 KB Output is correct
25 Correct 61 ms 1900 KB Output is correct
26 Correct 38 ms 1912 KB Output is correct
27 Correct 6 ms 1900 KB Output is correct
28 Partially correct 75 ms 1900 KB Partially correct - number of queries: 7862
29 Partially correct 49 ms 1900 KB Partially correct - number of queries: 6076
30 Partially correct 82 ms 1900 KB Partially correct - number of queries: 8278
31 Correct 6 ms 1900 KB Output is correct
32 Correct 12 ms 1912 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 22 ms 1900 KB Output is correct
35 Correct 8 ms 1900 KB Output is correct
36 Correct 31 ms 1900 KB Output is correct
37 Correct 8 ms 1900 KB Output is correct
38 Correct 5 ms 1900 KB Output is correct
39 Correct 40 ms 1900 KB Output is correct
40 Partially correct 68 ms 1900 KB Partially correct - number of queries: 7164
41 Partially correct 39 ms 1900 KB Partially correct - number of queries: 5174
42 Partially correct 62 ms 1912 KB Partially correct - number of queries: 5174
43 Correct 39 ms 1900 KB Output is correct
44 Correct 50 ms 1900 KB Output is correct
45 Correct 30 ms 1900 KB Output is correct
46 Correct 6 ms 1900 KB Output is correct
47 Correct 39 ms 1900 KB Output is correct
48 Partially correct 47 ms 1900 KB Partially correct - number of queries: 6286
49 Correct 11 ms 1900 KB Output is correct
50 Partially correct 68 ms 1900 KB Partially correct - number of queries: 8320
51 Correct 48 ms 1900 KB Output is correct
52 Correct 8 ms 1900 KB Output is correct
53 Correct 9 ms 1900 KB Output is correct
54 Correct 30 ms 1900 KB Output is correct
55 Correct 7 ms 1900 KB Output is correct
56 Partially correct 86 ms 1900 KB Partially correct - number of queries: 8324
57 Partially correct 68 ms 1900 KB Partially correct - number of queries: 6205
58 Partially correct 70 ms 1900 KB Partially correct - number of queries: 6278
59 Partially correct 49 ms 1900 KB Partially correct - number of queries: 5170
60 Correct 55 ms 1900 KB Output is correct
61 Correct 9 ms 1900 KB Output is correct
62 Correct 7 ms 1900 KB Output is correct
63 Correct 9 ms 1900 KB Output is correct
64 Correct 8 ms 2028 KB Output is correct
65 Correct 4 ms 2028 KB Output is correct
66 Correct 8 ms 1900 KB Output is correct
67 Correct 6 ms 1900 KB Output is correct
68 Correct 10 ms 1900 KB Output is correct
69 Correct 8 ms 1900 KB Output is correct
70 Correct 6 ms 1900 KB Output is correct
71 Partially correct 48 ms 2028 KB Partially correct - number of queries: 8188
72 Correct 9 ms 1900 KB Output is correct
73 Partially correct 69 ms 1900 KB Partially correct - number of queries: 8086
74 Partially correct 72 ms 1900 KB Partially correct - number of queries: 8126
75 Correct 9 ms 1900 KB Output is correct
76 Partially correct 63 ms 1900 KB Partially correct - number of queries: 7176
77 Partially correct 81 ms 1900 KB Partially correct - number of queries: 8343
78 Correct 13 ms 1900 KB Output is correct
79 Correct 46 ms 1900 KB Output is correct
80 Partially correct 102 ms 1900 KB Partially correct - number of queries: 8343
81 Partially correct 70 ms 1900 KB Partially correct - number of queries: 8348
82 Partially correct 74 ms 1900 KB Partially correct - number of queries: 8303
83 Correct 7 ms 1900 KB Output is correct
84 Partially correct 68 ms 1900 KB Partially correct - number of queries: 7074
85 Partially correct 78 ms 1900 KB Partially correct - number of queries: 8346
86 Partially correct 92 ms 1900 KB Partially correct - number of queries: 8038
87 Correct 12 ms 1920 KB Output is correct
88 Partially correct 51 ms 1900 KB Partially correct - number of queries: 7622
89 Partially correct 43 ms 1912 KB Partially correct - number of queries: 7976
90 Correct 8 ms 1900 KB Output is correct
91 Correct 58 ms 1900 KB Output is correct
92 Partially correct 68 ms 1900 KB Partially correct - number of queries: 7654
93 Partially correct 87 ms 1900 KB Partially correct - number of queries: 7541
94 Partially correct 78 ms 1900 KB Partially correct - number of queries: 7860
95 Partially correct 98 ms 1900 KB Partially correct - number of queries: 7872
96 Partially correct 64 ms 1900 KB Partially correct - number of queries: 7808
97 Partially correct 46 ms 1900 KB Partially correct - number of queries: 7118