답안 #99217

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
99217 2019-03-01T18:19:57 Z eriksuenderhauf 커다란 상품 (IOI17_prize) C++11
97.64 / 100
51 ms 5396 KB
#include <bits/stdc++.h>
#include "prize.h"
#define pii pair<int,innt>
#define vi vector<int>
#define fi first
#define se second
using namespace std;
typedef long long ll;
const int MAXN = 2e5 + 50;
vi ans[MAXN];
int cur = 0;
int ret = -1;

void solve(int l, int r) {
 if (r - l < 2 || ret != -1)
  return;
 if (ans[l][1] == ans[r][1])
  return;
 int m = (l + r) / 2;
 ans[m] = ask(m);
 if (ans[m][0] + ans[m][1] == 0) {
  ret = m;
  return;
 }
 if (ans[m][0] + ans[m][1] != cur) {
  solve(l, m);
  solve(m, r);
  return;
 }
 if (ans[l][0] == ans[m][0] && ans[m][0] == ans[r][0])
  return;
 if (ans[l][0] == ans[m][0])
  solve(m, r);
 else if (ans[l][0] == ans[m][0])
  solve(l, m);
 else {
  solve(l, m);
  if (ret != -1)
   return;
  solve(m, r);
 }
}

int find_best(int n) {
 int val = 454;
 for (int i = 0; i < min(n,455); i++) {
  ans[i] = ask(i);
  if (ans[i][0] + ans[i][1] == 0)
   return i;
  cur = max(cur, ans[i][0] + ans[i][1]);
  if (cur > 100) {
   val = i;
   break;
  }
 }
 if (val < n - 1)
  ans[n-1] = ask(n-1);
 if (ans[n-1][0] + ans[n-1][1] == 0)
  return n-1;
 solve(val,n-1);
 return ret;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 5128 KB Output is correct
2 Correct 13 ms 5112 KB Output is correct
3 Correct 8 ms 5020 KB Output is correct
4 Correct 11 ms 4992 KB Output is correct
5 Correct 11 ms 4992 KB Output is correct
6 Correct 7 ms 5116 KB Output is correct
7 Correct 9 ms 4992 KB Output is correct
8 Correct 10 ms 5012 KB Output is correct
9 Correct 12 ms 5036 KB Output is correct
10 Correct 12 ms 5112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 4992 KB Output is correct
2 Correct 10 ms 5020 KB Output is correct
3 Correct 12 ms 5100 KB Output is correct
4 Correct 12 ms 4912 KB Output is correct
5 Correct 10 ms 5012 KB Output is correct
6 Correct 8 ms 4992 KB Output is correct
7 Correct 11 ms 4992 KB Output is correct
8 Correct 9 ms 5132 KB Output is correct
9 Correct 8 ms 5128 KB Output is correct
10 Correct 13 ms 5036 KB Output is correct
11 Correct 11 ms 5112 KB Output is correct
12 Correct 12 ms 4992 KB Output is correct
13 Correct 15 ms 4992 KB Output is correct
14 Correct 8 ms 5112 KB Output is correct
15 Correct 14 ms 5096 KB Output is correct
16 Correct 38 ms 5260 KB Output is correct
17 Correct 3 ms 5112 KB Output is correct
18 Partially correct 47 ms 5396 KB Partially correct - number of queries: 5065
19 Correct 8 ms 4992 KB Output is correct
20 Correct 20 ms 4992 KB Output is correct
21 Correct 20 ms 5036 KB Output is correct
22 Correct 7 ms 5128 KB Output is correct
23 Correct 12 ms 4992 KB Output is correct
24 Correct 13 ms 4992 KB Output is correct
25 Correct 19 ms 5168 KB Output is correct
26 Correct 25 ms 4992 KB Output is correct
27 Correct 12 ms 5032 KB Output is correct
28 Correct 26 ms 5164 KB Output is correct
29 Correct 19 ms 5112 KB Output is correct
30 Partially correct 26 ms 5176 KB Partially correct - number of queries: 5021
31 Correct 6 ms 4992 KB Output is correct
32 Correct 10 ms 5136 KB Output is correct
33 Correct 6 ms 4992 KB Output is correct
34 Correct 23 ms 4992 KB Output is correct
35 Correct 9 ms 5144 KB Output is correct
36 Correct 28 ms 5120 KB Output is correct
37 Correct 11 ms 5112 KB Output is correct
38 Correct 13 ms 5032 KB Output is correct
39 Correct 15 ms 5084 KB Output is correct
40 Correct 24 ms 5252 KB Output is correct
41 Correct 24 ms 5104 KB Output is correct
42 Correct 19 ms 5208 KB Output is correct
43 Correct 33 ms 4992 KB Output is correct
44 Correct 23 ms 5004 KB Output is correct
45 Correct 21 ms 4992 KB Output is correct
46 Correct 7 ms 4992 KB Output is correct
47 Correct 26 ms 4992 KB Output is correct
48 Correct 38 ms 5112 KB Output is correct
49 Correct 10 ms 4992 KB Output is correct
50 Partially correct 45 ms 5112 KB Partially correct - number of queries: 5069
51 Correct 26 ms 4992 KB Output is correct
52 Correct 8 ms 5032 KB Output is correct
53 Correct 9 ms 5252 KB Output is correct
54 Correct 15 ms 5144 KB Output is correct
55 Correct 10 ms 4992 KB Output is correct
56 Partially correct 29 ms 5272 KB Partially correct - number of queries: 5068
57 Correct 35 ms 5164 KB Output is correct
58 Correct 36 ms 4984 KB Output is correct
59 Correct 28 ms 5032 KB Output is correct
60 Correct 31 ms 5068 KB Output is correct
61 Correct 11 ms 5156 KB Output is correct
62 Correct 13 ms 4992 KB Output is correct
63 Correct 8 ms 5136 KB Output is correct
64 Correct 9 ms 5128 KB Output is correct
65 Correct 9 ms 5120 KB Output is correct
66 Correct 8 ms 4992 KB Output is correct
67 Correct 8 ms 4992 KB Output is correct
68 Correct 11 ms 5012 KB Output is correct
69 Correct 9 ms 4992 KB Output is correct
70 Correct 9 ms 5112 KB Output is correct
71 Correct 47 ms 5236 KB Output is correct
72 Correct 14 ms 4992 KB Output is correct
73 Correct 44 ms 5240 KB Output is correct
74 Correct 44 ms 5184 KB Output is correct
75 Correct 11 ms 4992 KB Output is correct
76 Correct 37 ms 5112 KB Output is correct
77 Partially correct 36 ms 5184 KB Partially correct - number of queries: 5216
78 Correct 13 ms 5096 KB Output is correct
79 Correct 30 ms 4992 KB Output is correct
80 Partially correct 32 ms 5140 KB Partially correct - number of queries: 5236
81 Partially correct 49 ms 5240 KB Partially correct - number of queries: 5218
82 Partially correct 48 ms 5160 KB Partially correct - number of queries: 5215
83 Correct 10 ms 5024 KB Output is correct
84 Correct 37 ms 5040 KB Output is correct
85 Partially correct 51 ms 5160 KB Partially correct - number of queries: 5233
86 Correct 10 ms 4992 KB Output is correct
87 Correct 11 ms 4992 KB Output is correct
88 Correct 11 ms 5120 KB Output is correct
89 Correct 12 ms 5032 KB Output is correct
90 Correct 11 ms 5032 KB Output is correct
91 Correct 8 ms 5028 KB Output is correct
92 Correct 8 ms 5108 KB Output is correct
93 Correct 10 ms 4992 KB Output is correct
94 Correct 12 ms 5040 KB Output is correct
95 Correct 13 ms 5120 KB Output is correct
96 Correct 9 ms 5120 KB Output is correct
97 Correct 10 ms 4992 KB Output is correct