답안 #132740

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
132740 2019-07-19T12:41:39 Z Talant 커다란 상품 (IOI17_prize) C++17
93.1 / 100
82 ms 24076 KB
#include "prize.h"
#include <bits/stdc++.h>

#define sc second
#define fr first
#define mk make_pair
#define pb push_back

using namespace std;

const int N = (1e6 + 5);
const int inf = (1e9 + 7);

vector <int> res[N];
int mx,cur;

int find_best(int n) {
    for (int i = 0; i < min(n,500); i ++) {
          if (res[i].size() == 0)
          res[i] = ask(i);
          int s = res[i][0] + res[i][1];
          if (!s) return i;
          if (s >= mx) mx = s,cur = i;
    }
    while(1) {
          if (res[cur].size() == 0)
          res[cur] = ask(cur);
          if (res[cur][0] + res[cur][1] == 0) return cur;
          if (res[cur][0] + res[cur][1] != mx) {
                cur ++;
                continue;
          }
          int lf = res[cur][0];
          int rt = res[cur][1];
          int l = cur,r = min(cur + 1000,n - 1);
          while (r - l > 1) {
                int m = (r + l) >> 1;
                if (res[m].size() == 0)
                      res[m] = ask(m);
                if (res[m][0] + res[m][1] == 0) return m;
                if (res[m][0] == lf && res[m][1] == rt) l = m;
                else r = m;
          }
          if (res[r].size() == 0)
          res[r] = ask(r);
          if (res[r][0] + res[r][1] == 0) return r;
          if (res[r][0] == lf && res[r][1] == rt) l = r;
          cur = l + 1;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 23800 KB Output is correct
2 Correct 44 ms 23928 KB Output is correct
3 Correct 39 ms 23800 KB Output is correct
4 Correct 37 ms 23888 KB Output is correct
5 Correct 40 ms 23804 KB Output is correct
6 Correct 23 ms 23804 KB Output is correct
7 Correct 41 ms 23760 KB Output is correct
8 Correct 40 ms 23800 KB Output is correct
9 Correct 39 ms 23928 KB Output is correct
10 Correct 57 ms 23928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 23800 KB Output is correct
2 Correct 43 ms 23820 KB Output is correct
3 Correct 38 ms 23928 KB Output is correct
4 Correct 52 ms 23800 KB Output is correct
5 Correct 31 ms 23852 KB Output is correct
6 Correct 23 ms 23800 KB Output is correct
7 Correct 41 ms 23800 KB Output is correct
8 Correct 42 ms 23940 KB Output is correct
9 Correct 44 ms 23940 KB Output is correct
10 Correct 40 ms 23860 KB Output is correct
11 Correct 43 ms 23832 KB Output is correct
12 Correct 29 ms 23800 KB Output is correct
13 Correct 54 ms 23932 KB Output is correct
14 Correct 36 ms 23800 KB Output is correct
15 Correct 37 ms 23800 KB Output is correct
16 Correct 69 ms 23852 KB Output is correct
17 Correct 29 ms 23880 KB Output is correct
18 Partially correct 50 ms 23972 KB Partially correct - number of queries: 5501
19 Correct 26 ms 23824 KB Output is correct
20 Correct 45 ms 23800 KB Output is correct
21 Correct 34 ms 23864 KB Output is correct
22 Correct 33 ms 23816 KB Output is correct
23 Correct 36 ms 23800 KB Output is correct
24 Correct 40 ms 23720 KB Output is correct
25 Correct 61 ms 23892 KB Output is correct
26 Correct 41 ms 24024 KB Output is correct
27 Correct 34 ms 23800 KB Output is correct
28 Partially correct 51 ms 23980 KB Partially correct - number of queries: 5690
29 Correct 61 ms 23876 KB Output is correct
30 Partially correct 58 ms 23968 KB Partially correct - number of queries: 5537
31 Correct 30 ms 23800 KB Output is correct
32 Correct 45 ms 23840 KB Output is correct
33 Correct 23 ms 23800 KB Output is correct
34 Correct 45 ms 23924 KB Output is correct
35 Correct 48 ms 23940 KB Output is correct
36 Correct 42 ms 23804 KB Output is correct
37 Correct 28 ms 23824 KB Output is correct
38 Correct 27 ms 23952 KB Output is correct
39 Correct 50 ms 24076 KB Output is correct
40 Correct 50 ms 23912 KB Output is correct
41 Correct 73 ms 23804 KB Output is correct
42 Correct 57 ms 23956 KB Output is correct
43 Correct 41 ms 23892 KB Output is correct
44 Correct 52 ms 23824 KB Output is correct
45 Correct 38 ms 23948 KB Output is correct
46 Correct 25 ms 23804 KB Output is correct
47 Correct 38 ms 23896 KB Output is correct
48 Correct 63 ms 24008 KB Output is correct
49 Correct 32 ms 23800 KB Output is correct
50 Partially correct 70 ms 23968 KB Partially correct - number of queries: 5478
51 Correct 50 ms 23848 KB Output is correct
52 Correct 26 ms 23812 KB Output is correct
53 Correct 52 ms 23920 KB Output is correct
54 Correct 47 ms 23800 KB Output is correct
55 Correct 32 ms 23928 KB Output is correct
56 Partially correct 50 ms 23964 KB Partially correct - number of queries: 5499
57 Correct 70 ms 23800 KB Output is correct
58 Correct 43 ms 23916 KB Output is correct
59 Correct 49 ms 23964 KB Output is correct
60 Correct 56 ms 23932 KB Output is correct
61 Correct 36 ms 23872 KB Output is correct
62 Correct 27 ms 23824 KB Output is correct
63 Correct 50 ms 23800 KB Output is correct
64 Correct 46 ms 23976 KB Output is correct
65 Correct 53 ms 23880 KB Output is correct
66 Correct 58 ms 23996 KB Output is correct
67 Correct 58 ms 23800 KB Output is correct
68 Correct 28 ms 23800 KB Output is correct
69 Correct 55 ms 23848 KB Output is correct
70 Correct 55 ms 23800 KB Output is correct
71 Partially correct 63 ms 23924 KB Partially correct - number of queries: 5074
72 Correct 65 ms 23936 KB Output is correct
73 Partially correct 82 ms 23908 KB Partially correct - number of queries: 5018
74 Partially correct 69 ms 23928 KB Partially correct - number of queries: 5042
75 Correct 48 ms 23800 KB Output is correct
76 Correct 58 ms 24028 KB Output is correct
77 Partially correct 78 ms 24020 KB Partially correct - number of queries: 5403
78 Correct 64 ms 23928 KB Output is correct
79 Correct 45 ms 23896 KB Output is correct
80 Partially correct 76 ms 23928 KB Partially correct - number of queries: 5400
81 Partially correct 71 ms 23972 KB Partially correct - number of queries: 5376
82 Partially correct 77 ms 23892 KB Partially correct - number of queries: 5348
83 Correct 55 ms 23800 KB Output is correct
84 Correct 62 ms 23968 KB Output is correct
85 Partially correct 53 ms 23956 KB Partially correct - number of queries: 5344
86 Correct 57 ms 23928 KB Output is correct
87 Correct 54 ms 23800 KB Output is correct
88 Correct 60 ms 23932 KB Output is correct
89 Correct 38 ms 23804 KB Output is correct
90 Correct 50 ms 23800 KB Output is correct
91 Correct 52 ms 23800 KB Output is correct
92 Correct 50 ms 23932 KB Output is correct
93 Correct 49 ms 23928 KB Output is correct
94 Correct 56 ms 23800 KB Output is correct
95 Correct 51 ms 23892 KB Output is correct
96 Correct 53 ms 23800 KB Output is correct
97 Correct 51 ms 23800 KB Output is correct