답안 #58985

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
58985 2018-07-20T01:33:53 Z tugushka 커다란 상품 (IOI17_prize) C++14
90 / 100
128 ms 1508 KB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;

vector < int > res, a;
map < int, vector < int > > x;
map < int , int > cnt;
int sq, mx;

int find_best(int n){
	int now = 0;
	sq = sqrt(n);
	
	for( ; now < min(sq+30, n-1) ; now++ ){
		if( x[now].empty() ) res = ask(now);
		else res = ask(now);
		x[now] = res;
		cnt[res[0]+res[1]]++;
		mx = max( res[0]+res[1], mx );
		if( res[0] == 0 && res[1] == 0 ) return now;
	}
	
	while( 1 ){
		if( x[now].empty() ) res = ask(now);
		else res = ask(now);
		x[now] = res;
		if( res[0] == 0 && res[1] == 0 ) return now;
		
		if( res[0]+res[1] == mx ){
			int l = now, r = min(n-1, now+int(sqrt(n)));
			while( l < r ){
				int mid = (l+r+1)/2;
				if( x[mid].empty() )
					a = ask(mid),
					x[mid] = a;
				else a = x[mid];
				
				if( !a[0] && !a[1] ) return mid;
				
				if( res[0] == a[0] && res[1] == a[1] )
					l = mid;
				else r = mid-1;
			}
			now = l+1;
		}
		else now++;
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 412 KB Output is correct
2 Correct 43 ms 696 KB Output is correct
3 Correct 42 ms 696 KB Output is correct
4 Correct 76 ms 952 KB Output is correct
5 Correct 41 ms 952 KB Output is correct
6 Correct 3 ms 952 KB Output is correct
7 Correct 49 ms 960 KB Output is correct
8 Correct 24 ms 960 KB Output is correct
9 Correct 25 ms 960 KB Output is correct
10 Correct 60 ms 1176 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 1176 KB Output is correct
2 Correct 40 ms 1176 KB Output is correct
3 Correct 34 ms 1176 KB Output is correct
4 Correct 83 ms 1176 KB Output is correct
5 Correct 42 ms 1176 KB Output is correct
6 Correct 3 ms 1176 KB Output is correct
7 Correct 15 ms 1176 KB Output is correct
8 Correct 44 ms 1176 KB Output is correct
9 Correct 49 ms 1176 KB Output is correct
10 Correct 80 ms 1176 KB Output is correct
11 Correct 33 ms 1176 KB Output is correct
12 Correct 10 ms 1176 KB Output is correct
13 Correct 74 ms 1176 KB Output is correct
14 Correct 9 ms 1176 KB Output is correct
15 Correct 22 ms 1176 KB Output is correct
16 Correct 76 ms 1176 KB Output is correct
17 Correct 5 ms 1176 KB Output is correct
18 Partially correct 76 ms 1176 KB Partially correct - number of queries: 5404
19 Correct 12 ms 1176 KB Output is correct
20 Correct 29 ms 1176 KB Output is correct
21 Correct 34 ms 1176 KB Output is correct
22 Correct 23 ms 1176 KB Output is correct
23 Correct 8 ms 1176 KB Output is correct
24 Correct 13 ms 1176 KB Output is correct
25 Correct 28 ms 1176 KB Output is correct
26 Correct 69 ms 1176 KB Output is correct
27 Correct 25 ms 1176 KB Output is correct
28 Partially correct 64 ms 1348 KB Partially correct - number of queries: 7737
29 Partially correct 89 ms 1348 KB Partially correct - number of queries: 6512
30 Partially correct 84 ms 1348 KB Partially correct - number of queries: 5605
31 Correct 10 ms 1348 KB Output is correct
32 Correct 59 ms 1348 KB Output is correct
33 Correct 3 ms 1348 KB Output is correct
34 Correct 28 ms 1348 KB Output is correct
35 Correct 47 ms 1348 KB Output is correct
36 Correct 28 ms 1348 KB Output is correct
37 Correct 18 ms 1348 KB Output is correct
38 Correct 17 ms 1348 KB Output is correct
39 Correct 33 ms 1348 KB Output is correct
40 Partially correct 76 ms 1508 KB Partially correct - number of queries: 8741
41 Correct 46 ms 1508 KB Output is correct
42 Correct 41 ms 1508 KB Output is correct
43 Correct 45 ms 1508 KB Output is correct
44 Correct 21 ms 1508 KB Output is correct
45 Correct 53 ms 1508 KB Output is correct
46 Correct 9 ms 1508 KB Output is correct
47 Correct 59 ms 1508 KB Output is correct
48 Correct 23 ms 1508 KB Output is correct
49 Correct 16 ms 1508 KB Output is correct
50 Partially correct 33 ms 1508 KB Partially correct - number of queries: 5425
51 Correct 39 ms 1508 KB Output is correct
52 Correct 9 ms 1508 KB Output is correct
53 Correct 77 ms 1508 KB Output is correct
54 Correct 48 ms 1508 KB Output is correct
55 Correct 5 ms 1508 KB Output is correct
56 Partially correct 48 ms 1508 KB Partially correct - number of queries: 5411
57 Correct 47 ms 1508 KB Output is correct
58 Correct 59 ms 1508 KB Output is correct
59 Correct 50 ms 1508 KB Output is correct
60 Correct 48 ms 1508 KB Output is correct
61 Correct 65 ms 1508 KB Output is correct
62 Correct 17 ms 1508 KB Output is correct
63 Correct 24 ms 1508 KB Output is correct
64 Correct 40 ms 1508 KB Output is correct
65 Correct 74 ms 1508 KB Output is correct
66 Partially correct 34 ms 1508 KB Partially correct - number of queries: 5395
67 Correct 57 ms 1508 KB Output is correct
68 Correct 8 ms 1508 KB Output is correct
69 Partially correct 45 ms 1508 KB Partially correct - number of queries: 5378
70 Correct 70 ms 1508 KB Output is correct
71 Partially correct 113 ms 1508 KB Partially correct - number of queries: 7758
72 Partially correct 82 ms 1508 KB Partially correct - number of queries: 5130
73 Partially correct 128 ms 1508 KB Partially correct - number of queries: 7720
74 Partially correct 95 ms 1508 KB Partially correct - number of queries: 7734
75 Correct 63 ms 1508 KB Output is correct
76 Partially correct 106 ms 1508 KB Partially correct - number of queries: 7326
77 Partially correct 101 ms 1508 KB Partially correct - number of queries: 7758
78 Partially correct 66 ms 1508 KB Partially correct - number of queries: 5125
79 Partially correct 71 ms 1508 KB Partially correct - number of queries: 6186
80 Partially correct 117 ms 1508 KB Partially correct - number of queries: 7758
81 Partially correct 98 ms 1508 KB Partially correct - number of queries: 7765
82 Partially correct 100 ms 1508 KB Partially correct - number of queries: 7745
83 Correct 30 ms 1508 KB Output is correct
84 Partially correct 87 ms 1508 KB Partially correct - number of queries: 7225
85 Partially correct 122 ms 1508 KB Partially correct - number of queries: 7742
86 Correct 72 ms 1508 KB Output is correct
87 Correct 38 ms 1508 KB Output is correct
88 Correct 54 ms 1508 KB Output is correct
89 Correct 66 ms 1508 KB Output is correct
90 Correct 75 ms 1508 KB Output is correct
91 Correct 33 ms 1508 KB Output is correct
92 Correct 39 ms 1508 KB Output is correct
93 Correct 36 ms 1508 KB Output is correct
94 Partially correct 41 ms 1508 KB Partially correct - number of queries: 5059
95 Partially correct 28 ms 1508 KB Partially correct - number of queries: 5049
96 Partially correct 32 ms 1508 KB Partially correct - number of queries: 5033
97 Correct 66 ms 1508 KB Output is correct