# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
333191 | 2020-12-04T22:25:26 Z | mohamedsobhi777 | 커다란 상품 (IOI17_prize) | C++14 | 111 ms | 5484 KB |
#include "prize.h" #include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; 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 <= 4000) return solve1(n); for (int i = 0; i < 1000; ++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 < 1000; ++i) enough += sum(i) != mc; for (int i = 1000; i < n; ++i) { Ask(i); if (sum(i) != mc) { if (sum(i) == 0) return i; ++enough; continue; } int lo = i, hi = 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 | 17 ms | 5100 KB | Output is correct |
2 | Correct | 9 ms | 5124 KB | Output is correct |
3 | Correct | 10 ms | 5100 KB | Output is correct |
4 | Correct | 17 ms | 5100 KB | Output is correct |
5 | Correct | 13 ms | 5100 KB | Output is correct |
6 | Correct | 4 ms | 4972 KB | Output is correct |
7 | Correct | 17 ms | 5100 KB | Output is correct |
8 | Correct | 14 ms | 5100 KB | Output is correct |
9 | Correct | 14 ms | 5100 KB | Output is correct |
10 | Correct | 16 ms | 5100 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 5112 KB | Output is correct |
2 | Correct | 17 ms | 5100 KB | Output is correct |
3 | Correct | 12 ms | 5124 KB | Output is correct |
4 | Correct | 15 ms | 5076 KB | Output is correct |
5 | Correct | 12 ms | 5120 KB | Output is correct |
6 | Correct | 4 ms | 4972 KB | Output is correct |
7 | Correct | 12 ms | 5100 KB | Output is correct |
8 | Correct | 9 ms | 5124 KB | Output is correct |
9 | Correct | 17 ms | 5100 KB | Output is correct |
10 | Correct | 13 ms | 5100 KB | Output is correct |
11 | Correct | 16 ms | 5100 KB | Output is correct |
12 | Correct | 9 ms | 5124 KB | Output is correct |
13 | Correct | 23 ms | 5100 KB | Output is correct |
14 | Correct | 16 ms | 5100 KB | Output is correct |
15 | Correct | 16 ms | 5172 KB | Output is correct |
16 | Partially correct | 80 ms | 5228 KB | Partially correct - number of queries: 7692 |
17 | Correct | 9 ms | 4972 KB | Output is correct |
18 | Partially correct | 66 ms | 5320 KB | Partially correct - number of queries: 8853 |
19 | Correct | 9 ms | 4972 KB | Output is correct |
20 | Correct | 20 ms | 5196 KB | Output is correct |
21 | Correct | 43 ms | 5100 KB | Output is correct |
22 | Correct | 20 ms | 5100 KB | Output is correct |
23 | Correct | 10 ms | 5124 KB | Output is correct |
24 | Correct | 13 ms | 5100 KB | Output is correct |
25 | Partially correct | 53 ms | 5228 KB | Partially correct - number of queries: 5393 |
26 | Partially correct | 53 ms | 5484 KB | Partially correct - number of queries: 5318 |
27 | Correct | 18 ms | 5100 KB | Output is correct |
28 | Partially correct | 72 ms | 5356 KB | Partially correct - number of queries: 8323 |
29 | Partially correct | 89 ms | 5228 KB | Partially correct - number of queries: 6618 |
30 | Partially correct | 105 ms | 5356 KB | Partially correct - number of queries: 8781 |
31 | Correct | 7 ms | 4972 KB | Output is correct |
32 | Correct | 28 ms | 5100 KB | Output is correct |
33 | Correct | 4 ms | 4972 KB | Output is correct |
34 | Correct | 34 ms | 5100 KB | Output is correct |
35 | Correct | 19 ms | 5100 KB | Output is correct |
36 | Correct | 38 ms | 5100 KB | Output is correct |
37 | Correct | 18 ms | 5100 KB | Output is correct |
38 | Correct | 16 ms | 5100 KB | Output is correct |
39 | Correct | 77 ms | 5100 KB | Output is correct |
40 | Partially correct | 84 ms | 5356 KB | Partially correct - number of queries: 7649 |
41 | Partially correct | 67 ms | 5384 KB | Partially correct - number of queries: 5713 |
42 | Partially correct | 47 ms | 5228 KB | Partially correct - number of queries: 5713 |
43 | Partially correct | 72 ms | 5228 KB | Partially correct - number of queries: 5230 |
44 | Correct | 42 ms | 5160 KB | Output is correct |
45 | Correct | 39 ms | 5100 KB | Output is correct |
46 | Correct | 9 ms | 4972 KB | Output is correct |
47 | Correct | 58 ms | 5144 KB | Output is correct |
48 | Partially correct | 65 ms | 5360 KB | Partially correct - number of queries: 6809 |
49 | Correct | 12 ms | 5152 KB | Output is correct |
50 | Partially correct | 108 ms | 5356 KB | Partially correct - number of queries: 8853 |
51 | Correct | 37 ms | 5320 KB | Output is correct |
52 | Correct | 18 ms | 5100 KB | Output is correct |
53 | Correct | 19 ms | 5100 KB | Output is correct |
54 | Correct | 52 ms | 5256 KB | Output is correct |
55 | Correct | 9 ms | 4972 KB | Output is correct |
56 | Partially correct | 80 ms | 5356 KB | Partially correct - number of queries: 8848 |
57 | Partially correct | 63 ms | 5228 KB | Partially correct - number of queries: 6710 |
58 | Partially correct | 65 ms | 5228 KB | Partially correct - number of queries: 6791 |
59 | Partially correct | 70 ms | 5228 KB | Partially correct - number of queries: 5710 |
60 | Partially correct | 52 ms | 5228 KB | Partially correct - number of queries: 5343 |
61 | Correct | 16 ms | 5100 KB | Output is correct |
62 | Correct | 13 ms | 5100 KB | Output is correct |
63 | Correct | 11 ms | 5116 KB | Output is correct |
64 | Correct | 16 ms | 5100 KB | Output is correct |
65 | Correct | 14 ms | 5100 KB | Output is correct |
66 | Correct | 18 ms | 5100 KB | Output is correct |
67 | Correct | 17 ms | 5100 KB | Output is correct |
68 | Correct | 11 ms | 4972 KB | Output is correct |
69 | Correct | 23 ms | 5076 KB | Output is correct |
70 | Correct | 12 ms | 5100 KB | Output is correct |
71 | Partially correct | 99 ms | 5476 KB | Partially correct - number of queries: 8772 |
72 | Correct | 23 ms | 5100 KB | Output is correct |
73 | Partially correct | 111 ms | 5356 KB | Partially correct - number of queries: 8668 |
74 | Partially correct | 77 ms | 5228 KB | Partially correct - number of queries: 8707 |
75 | Correct | 14 ms | 5100 KB | Output is correct |
76 | Partially correct | 90 ms | 5356 KB | Partially correct - number of queries: 7617 |
77 | Partially correct | 80 ms | 5356 KB | Partially correct - number of queries: 8856 |
78 | Correct | 24 ms | 5100 KB | Output is correct |
79 | Correct | 36 ms | 5228 KB | Output is correct |
80 | Partially correct | 83 ms | 5356 KB | Partially correct - number of queries: 8895 |
81 | Partially correct | 80 ms | 5356 KB | Partially correct - number of queries: 8922 |
82 | Partially correct | 90 ms | 5228 KB | Partially correct - number of queries: 8761 |
83 | Correct | 16 ms | 5100 KB | Output is correct |
84 | Partially correct | 74 ms | 5228 KB | Partially correct - number of queries: 7403 |
85 | Partially correct | 88 ms | 5404 KB | Partially correct - number of queries: 8865 |
86 | Correct | 13 ms | 5100 KB | Output is correct |
87 | Correct | 13 ms | 5100 KB | Output is correct |
88 | Correct | 14 ms | 5100 KB | Output is correct |
89 | Correct | 17 ms | 5100 KB | Output is correct |
90 | Correct | 14 ms | 5100 KB | Output is correct |
91 | Correct | 13 ms | 5100 KB | Output is correct |
92 | Correct | 13 ms | 5100 KB | Output is correct |
93 | Correct | 22 ms | 5100 KB | Output is correct |
94 | Correct | 17 ms | 5100 KB | Output is correct |
95 | Correct | 16 ms | 5228 KB | Output is correct |
96 | Correct | 20 ms | 5100 KB | Output is correct |
97 | Correct | 12 ms | 5100 KB | Output is correct |