답안 #423291

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
423291 2021-06-10T22:43:55 Z albertolg101 커다란 상품 (IOI17_prize) C++17
90 / 100
113 ms 5436 KB
#include <bits/stdc++.h>
#include "prize.h"

using namespace std; 

int find_best(int n) {

	vector<vector<int>> query(n);

	function<vector<int>(int)> f = [&](int x)
	{
		if(query[x].empty())
			query[x] = ask(x);

		return query[x];
	};

	function<bool(int, int)> rng = [&](int l, int r)
	{
		f(l), f(r);

		if(query[l][0] + query[l][1] == query[r][0] + query[r][1] and 0 == query[r][0] - query[l][0])
			return false;
		
		return true;
	};

	function<int(int, int)> dandc = [&](int l, int r)
	{
		int mid = (l + r) / 2;
		f(mid);

		if(query[mid][0] + query[mid][1] == 0)
			return mid;

		int ans = -1;

		if(rng(l, mid))
			ans = max(ans, dandc(l, mid));

		if(rng(mid+1, r))
			ans = max(ans, dandc(mid+1, r));

		return ans;
	};

	if(f(0)[0] + f(0)[1] == 0)
		return 0;

	if(f(n-1)[0] + f(n-1)[1] == 0)
		return n-1;

	return dandc(0, n-1);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4936 KB Output is correct
2 Correct 3 ms 4876 KB Output is correct
3 Correct 3 ms 4888 KB Output is correct
4 Correct 3 ms 4888 KB Output is correct
5 Correct 3 ms 4868 KB Output is correct
6 Correct 4 ms 4892 KB Output is correct
7 Correct 3 ms 4928 KB Output is correct
8 Correct 3 ms 4936 KB Output is correct
9 Correct 3 ms 4928 KB Output is correct
10 Correct 4 ms 4936 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4888 KB Output is correct
2 Correct 4 ms 4928 KB Output is correct
3 Correct 4 ms 4928 KB Output is correct
4 Correct 3 ms 4928 KB Output is correct
5 Correct 3 ms 4884 KB Output is correct
6 Correct 3 ms 4884 KB Output is correct
7 Correct 3 ms 4928 KB Output is correct
8 Correct 4 ms 4928 KB Output is correct
9 Correct 3 ms 4884 KB Output is correct
10 Correct 4 ms 4936 KB Output is correct
11 Correct 14 ms 4988 KB Output is correct
12 Correct 13 ms 5020 KB Output is correct
13 Correct 7 ms 5012 KB Output is correct
14 Correct 15 ms 712 KB Output is correct
15 Partially correct 42 ms 5272 KB Partially correct - number of queries: 7759
16 Partially correct 80 ms 5140 KB Partially correct - number of queries: 8136
17 Partially correct 107 ms 5140 KB Partially correct - number of queries: 8134
18 Partially correct 75 ms 5140 KB Partially correct - number of queries: 8135
19 Partially correct 92 ms 5184 KB Partially correct - number of queries: 7685
20 Partially correct 52 ms 2824 KB Partially correct - number of queries: 5261
21 Partially correct 97 ms 5132 KB Partially correct - number of queries: 8081
22 Partially correct 77 ms 5140 KB Partially correct - number of queries: 6248
23 Correct 7 ms 4888 KB Output is correct
24 Correct 12 ms 4884 KB Output is correct
25 Partially correct 97 ms 5132 KB Partially correct - number of queries: 7392
26 Partially correct 44 ms 5436 KB Partially correct - number of queries: 7388
27 Correct 5 ms 4996 KB Output is correct
28 Partially correct 90 ms 5184 KB Partially correct - number of queries: 7281
29 Partially correct 72 ms 5140 KB Partially correct - number of queries: 6202
30 Partially correct 87 ms 5140 KB Partially correct - number of queries: 8075
31 Partially correct 100 ms 5140 KB Partially correct - number of queries: 8081
32 Correct 7 ms 5016 KB Output is correct
33 Correct 1 ms 200 KB Output is correct
34 Partially correct 89 ms 5216 KB Partially correct - number of queries: 8138
35 Correct 5 ms 5056 KB Output is correct
36 Partially correct 98 ms 5184 KB Partially correct - number of queries: 8069
37 Correct 11 ms 4936 KB Output is correct
38 Correct 5 ms 4928 KB Output is correct
39 Partially correct 42 ms 5232 KB Partially correct - number of queries: 8071
40 Partially correct 81 ms 5120 KB Partially correct - number of queries: 7044
41 Partially correct 84 ms 5300 KB Partially correct - number of queries: 8133
42 Partially correct 77 ms 5184 KB Partially correct - number of queries: 8133
43 Partially correct 86 ms 5312 KB Partially correct - number of queries: 7908
44 Partially correct 45 ms 5212 KB Partially correct - number of queries: 8129
45 Partially correct 41 ms 5212 KB Partially correct - number of queries: 7340
46 Partially correct 48 ms 5224 KB Partially correct - number of queries: 8125
47 Partially correct 71 ms 5392 KB Partially correct - number of queries: 7436
48 Partially correct 88 ms 5140 KB Partially correct - number of queries: 8134
49 Partially correct 103 ms 5312 KB Partially correct - number of queries: 8127
50 Partially correct 111 ms 5228 KB Partially correct - number of queries: 8127
51 Partially correct 80 ms 5284 KB Partially correct - number of queries: 8132
52 Partially correct 84 ms 5140 KB Partially correct - number of queries: 8127
53 Correct 5 ms 4892 KB Output is correct
54 Partially correct 88 ms 5112 KB Partially correct - number of queries: 8071
55 Partially correct 90 ms 5216 KB Partially correct - number of queries: 8130
56 Partially correct 80 ms 5184 KB Partially correct - number of queries: 8130
57 Partially correct 103 ms 5156 KB Partially correct - number of queries: 8073
58 Partially correct 55 ms 5216 KB Partially correct - number of queries: 8137
59 Partially correct 95 ms 5288 KB Partially correct - number of queries: 8133
60 Partially correct 113 ms 5136 KB Partially correct - number of queries: 8076
61 Correct 5 ms 4936 KB Output is correct
62 Correct 4 ms 5052 KB Output is correct
63 Correct 6 ms 4936 KB Output is correct
64 Correct 5 ms 4884 KB Output is correct
65 Correct 4 ms 4996 KB Output is correct
66 Correct 4 ms 4880 KB Output is correct
67 Correct 3 ms 4884 KB Output is correct
68 Correct 3 ms 4892 KB Output is correct
69 Correct 4 ms 4936 KB Output is correct
70 Correct 4 ms 4892 KB Output is correct
71 Partially correct 87 ms 5196 KB Partially correct - number of queries: 8104
72 Correct 11 ms 4936 KB Output is correct
73 Partially correct 90 ms 5120 KB Partially correct - number of queries: 7999
74 Partially correct 89 ms 5376 KB Partially correct - number of queries: 8044
75 Correct 7 ms 4936 KB Output is correct
76 Partially correct 83 ms 5184 KB Partially correct - number of queries: 7024
77 Partially correct 100 ms 5280 KB Partially correct - number of queries: 8114
78 Correct 11 ms 4936 KB Output is correct
79 Correct 45 ms 5056 KB Output is correct
80 Partially correct 105 ms 5208 KB Partially correct - number of queries: 8110
81 Partially correct 95 ms 5116 KB Partially correct - number of queries: 8110
82 Partially correct 73 ms 5228 KB Partially correct - number of queries: 8036
83 Correct 5 ms 4936 KB Output is correct
84 Partially correct 74 ms 5140 KB Partially correct - number of queries: 6790
85 Partially correct 50 ms 5332 KB Partially correct - number of queries: 8107
86 Correct 19 ms 5016 KB Output is correct
87 Correct 10 ms 4936 KB Output is correct
88 Correct 16 ms 5008 KB Output is correct
89 Correct 14 ms 4936 KB Output is correct
90 Correct 4 ms 4936 KB Output is correct
91 Correct 9 ms 4936 KB Output is correct
92 Correct 3 ms 4936 KB Output is correct
93 Correct 11 ms 4936 KB Output is correct
94 Correct 11 ms 4936 KB Output is correct
95 Correct 11 ms 4936 KB Output is correct
96 Correct 9 ms 4936 KB Output is correct
97 Correct 3 ms 4936 KB Output is correct