# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
333203 | 2020-12-04T22:43:01 Z | mohamedsobhi777 | 커다란 상품 (IOI17_prize) | C++14 | 89 ms | 5432 KB |
#include "prize.h" #include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; const int thr = 950; vector<int> Qu[200000 + 10]; int freq[200000 + 10]; int enough; vector<int> Ask(int i) { if (Qu[i].empty()) Qu[i] = ask(i); return Qu[i]; } inline int sum(int i) { return Qu[i][0] + Qu[i][1]; } int solve1(int n) { for (int i = 0; i < n; ++i) { Ask(i); if (!sum(i)) return i; } } int find_best(int n) { if (n <= 4800) return solve1(n); for (int i = 0; i < thr; ++i) { Ask(i); freq[sum(i)]++; if (sum(i) == 0) return i; } int mc = 0, Max = 0; for (int i = 0; i < N; ++i) { if (freq[i] > Max) Max = freq[i], mc = i; } for (int i = 0; i < thr; ++i) enough += sum(i) != mc; for (int i = thr; i < n; ++i) { Ask(i); if (sum(i) != mc) { if (sum(i) == 0) return i; ++enough; continue; } int lo = i, hi = min(i + 500, n - 1); int j = i; while (lo <= hi) { int mid = (lo + hi) >> 1; Ask(mid); if (sum(mid) != mc || Qu[mid][0] - enough > 0) hi = mid - 1; else j = mid, lo = mid + 1; } i = j; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 18 ms | 5100 KB | Output is correct |
2 | Correct | 32 ms | 5228 KB | Output is correct |
3 | Correct | 19 ms | 5196 KB | Output is correct |
4 | Correct | 44 ms | 5228 KB | Output is correct |
5 | Correct | 31 ms | 5100 KB | Output is correct |
6 | Correct | 4 ms | 5100 KB | Output is correct |
7 | Correct | 31 ms | 5100 KB | Output is correct |
8 | Correct | 29 ms | 5100 KB | Output is correct |
9 | Correct | 20 ms | 5196 KB | Output is correct |
10 | Correct | 44 ms | 5228 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 5152 KB | Output is correct |
2 | Correct | 35 ms | 5100 KB | Output is correct |
3 | Correct | 32 ms | 5228 KB | Output is correct |
4 | Correct | 46 ms | 5356 KB | Output is correct |
5 | Correct | 19 ms | 5196 KB | Output is correct |
6 | Correct | 4 ms | 4972 KB | Output is correct |
7 | Correct | 20 ms | 5196 KB | Output is correct |
8 | Correct | 26 ms | 5100 KB | Output is correct |
9 | Correct | 22 ms | 5300 KB | Output is correct |
10 | Correct | 47 ms | 5228 KB | Output is correct |
11 | Correct | 30 ms | 5100 KB | Output is correct |
12 | Correct | 15 ms | 5100 KB | Output is correct |
13 | Partially correct | 52 ms | 5228 KB | Partially correct - number of queries: 5003 |
14 | Correct | 17 ms | 5100 KB | Output is correct |
15 | Correct | 19 ms | 5100 KB | Output is correct |
16 | Correct | 39 ms | 5228 KB | Output is correct |
17 | Correct | 6 ms | 5116 KB | Output is correct |
18 | Partially correct | 44 ms | 5292 KB | Partially correct - number of queries: 5356 |
19 | Correct | 8 ms | 4972 KB | Output is correct |
20 | Correct | 20 ms | 5228 KB | Output is correct |
21 | Correct | 28 ms | 5100 KB | Output is correct |
22 | Correct | 20 ms | 5100 KB | Output is correct |
23 | Correct | 18 ms | 5100 KB | Output is correct |
24 | Correct | 10 ms | 5124 KB | Output is correct |
25 | Correct | 43 ms | 5228 KB | Output is correct |
26 | Correct | 42 ms | 5100 KB | Output is correct |
27 | Correct | 28 ms | 5100 KB | Output is correct |
28 | Partially correct | 66 ms | 5228 KB | Partially correct - number of queries: 7132 |
29 | Partially correct | 73 ms | 5244 KB | Partially correct - number of queries: 6193 |
30 | Partially correct | 54 ms | 5228 KB | Partially correct - number of queries: 5244 |
31 | Correct | 9 ms | 4972 KB | Output is correct |
32 | Correct | 33 ms | 5100 KB | Output is correct |
33 | Correct | 4 ms | 4972 KB | Output is correct |
34 | Correct | 27 ms | 5100 KB | Output is correct |
35 | Correct | 30 ms | 5284 KB | Output is correct |
36 | Correct | 20 ms | 5100 KB | Output is correct |
37 | Correct | 20 ms | 5100 KB | Output is correct |
38 | Correct | 17 ms | 5100 KB | Output is correct |
39 | Correct | 29 ms | 5100 KB | Output is correct |
40 | Correct | 58 ms | 5256 KB | Output is correct |
41 | Correct | 32 ms | 5296 KB | Output is correct |
42 | Correct | 37 ms | 5100 KB | Output is correct |
43 | Correct | 33 ms | 5100 KB | Output is correct |
44 | Correct | 19 ms | 5160 KB | Output is correct |
45 | Correct | 35 ms | 5100 KB | Output is correct |
46 | Correct | 10 ms | 4972 KB | Output is correct |
47 | Correct | 38 ms | 5100 KB | Output is correct |
48 | Correct | 39 ms | 5100 KB | Output is correct |
49 | Correct | 17 ms | 5100 KB | Output is correct |
50 | Partially correct | 32 ms | 5268 KB | Partially correct - number of queries: 5374 |
51 | Correct | 31 ms | 5100 KB | Output is correct |
52 | Correct | 17 ms | 5100 KB | Output is correct |
53 | Correct | 43 ms | 5100 KB | Output is correct |
54 | Correct | 31 ms | 5100 KB | Output is correct |
55 | Correct | 7 ms | 4972 KB | Output is correct |
56 | Partially correct | 57 ms | 5228 KB | Partially correct - number of queries: 5362 |
57 | Correct | 42 ms | 5100 KB | Output is correct |
58 | Correct | 42 ms | 5100 KB | Output is correct |
59 | Correct | 46 ms | 5228 KB | Output is correct |
60 | Correct | 44 ms | 5100 KB | Output is correct |
61 | Correct | 44 ms | 5228 KB | Output is correct |
62 | Correct | 11 ms | 5120 KB | Output is correct |
63 | Correct | 61 ms | 5100 KB | Output is correct |
64 | Correct | 41 ms | 5100 KB | Output is correct |
65 | Correct | 59 ms | 5244 KB | Output is correct |
66 | Partially correct | 68 ms | 5228 KB | Partially correct - number of queries: 5384 |
67 | Correct | 54 ms | 5196 KB | Output is correct |
68 | Correct | 8 ms | 4972 KB | Output is correct |
69 | Partially correct | 60 ms | 5356 KB | Partially correct - number of queries: 5367 |
70 | Correct | 60 ms | 5228 KB | Output is correct |
71 | Partially correct | 83 ms | 5228 KB | Partially correct - number of queries: 6818 |
72 | Partially correct | 45 ms | 5228 KB | Partially correct - number of queries: 5057 |
73 | Partially correct | 62 ms | 5292 KB | Partially correct - number of queries: 6786 |
74 | Partially correct | 74 ms | 5176 KB | Partially correct - number of queries: 6802 |
75 | Correct | 65 ms | 5228 KB | Output is correct |
76 | Partially correct | 65 ms | 5432 KB | Partially correct - number of queries: 6529 |
77 | Partially correct | 85 ms | 5228 KB | Partially correct - number of queries: 7072 |
78 | Partially correct | 67 ms | 5228 KB | Partially correct - number of queries: 5065 |
79 | Partially correct | 64 ms | 5228 KB | Partially correct - number of queries: 5869 |
80 | Partially correct | 63 ms | 5228 KB | Partially correct - number of queries: 7032 |
81 | Partially correct | 61 ms | 5228 KB | Partially correct - number of queries: 7075 |
82 | Partially correct | 89 ms | 5260 KB | Partially correct - number of queries: 7014 |
83 | Correct | 51 ms | 5228 KB | Output is correct |
84 | Partially correct | 84 ms | 5356 KB | Partially correct - number of queries: 6640 |
85 | Partially correct | 68 ms | 5228 KB | Partially correct - number of queries: 7014 |
86 | Correct | 54 ms | 5228 KB | Output is correct |
87 | Correct | 30 ms | 5340 KB | Output is correct |
88 | Correct | 57 ms | 5228 KB | Output is correct |
89 | Correct | 52 ms | 5228 KB | Output is correct |
90 | Correct | 67 ms | 5228 KB | Output is correct |
91 | Correct | 45 ms | 5228 KB | Output is correct |
92 | Correct | 48 ms | 5232 KB | Output is correct |
93 | Correct | 41 ms | 5228 KB | Output is correct |
94 | Partially correct | 53 ms | 5228 KB | Partially correct - number of queries: 5040 |
95 | Partially correct | 44 ms | 5228 KB | Partially correct - number of queries: 5006 |
96 | Partially correct | 57 ms | 5228 KB | Partially correct - number of queries: 5018 |
97 | Correct | 40 ms | 5100 KB | Output is correct |