답안 #283720

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
283720 2020-08-26T06:04:11 Z 2qbingxuan 커다란 상품 (IOI17_prize) C++14
90 / 100
104 ms 384 KB
#include "prize.h"

#include <bits/stdc++.h>
#ifdef local
#define debug(...) QQBX(#__VA_ARGS__, __VA_ARGS__)
void QQBX(const char *s) {}
template <typename H, typename ...T> void QQBX(const char *s, const H&h, T &&...args) {
    for(; *s && *s != ','; ++s) if(*s != ' ') std::cerr << *s;
    std::cerr << " = " << h << (sizeof...(T) ? ", " : "\n");
    if(sizeof...(T)) QQBX(++s, args...);
}
#define safe std::cerr<<__PRETTY_FUNCTION<<" line "<<__LINE__<<" safe\n";
#else
#define debug(...) ((void)0)
#define safe ((void)0)
#endif // local

using namespace std;

int find_best(int n) {
    // 1 + 2 + 5 + x + x^2+1 <= 200000
    // non-lolipop box: 
    // x <= 447;
    /* for(int i = 0; i < n; i++) { */
    /*     vector<int> res = ask(i); */
    /*     if(res[0]+res[1]==0) return i; */
    /* } */
    mt19937 rng(7122);
    int mx = 0;
    for(int i = 0; i < 1000; i++) {
        auto res = ask(uniform_int_distribution<int>(0, n-1)(rng));
        mx = max(mx, res[0]+res[1]);
    }
    int x = 0;
    for(int i = 0; i < 500; i++) {
        for(int s = 1<<__lg(n); s; s>>=1) if(x+s < n) {
            auto res = ask(x+s);
            if(res[0]+res[1] == 0) return x+s;
            if(res[0]+res[1] == mx && res[0] == i) x += s;
        }
        auto res = ask(x);
        if(res[0]+res[1] == 0) return x;
        ++x;
    }
    return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 256 KB Output is correct
2 Correct 13 ms 256 KB Output is correct
3 Correct 12 ms 256 KB Output is correct
4 Correct 9 ms 256 KB Output is correct
5 Correct 10 ms 256 KB Output is correct
6 Correct 8 ms 256 KB Output is correct
7 Correct 10 ms 256 KB Output is correct
8 Correct 6 ms 256 KB Output is correct
9 Correct 9 ms 256 KB Output is correct
10 Correct 10 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 256 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 10 ms 256 KB Output is correct
4 Correct 13 ms 256 KB Output is correct
5 Correct 10 ms 256 KB Output is correct
6 Correct 7 ms 256 KB Output is correct
7 Correct 10 ms 256 KB Output is correct
8 Correct 10 ms 256 KB Output is correct
9 Correct 7 ms 256 KB Output is correct
10 Correct 9 ms 256 KB Output is correct
11 Correct 10 ms 256 KB Output is correct
12 Correct 10 ms 288 KB Output is correct
13 Correct 19 ms 256 KB Output is correct
14 Correct 17 ms 256 KB Output is correct
15 Correct 27 ms 256 KB Output is correct
16 Partially correct 83 ms 256 KB Partially correct - number of queries: 8129
17 Correct 11 ms 256 KB Output is correct
18 Partially correct 72 ms 256 KB Partially correct - number of queries: 9363
19 Correct 12 ms 256 KB Output is correct
20 Correct 17 ms 384 KB Output is correct
21 Correct 38 ms 256 KB Output is correct
22 Correct 9 ms 376 KB Output is correct
23 Correct 10 ms 256 KB Output is correct
24 Correct 11 ms 384 KB Output is correct
25 Partially correct 47 ms 256 KB Partially correct - number of queries: 5746
26 Partially correct 55 ms 256 KB Partially correct - number of queries: 5706
27 Correct 11 ms 256 KB Output is correct
28 Partially correct 59 ms 256 KB Partially correct - number of queries: 8975
29 Partially correct 45 ms 376 KB Partially correct - number of queries: 7033
30 Partially correct 49 ms 376 KB Partially correct - number of queries: 9291
31 Correct 6 ms 376 KB Output is correct
32 Correct 8 ms 376 KB Output is correct
33 Correct 8 ms 256 KB Output is correct
34 Correct 27 ms 384 KB Output is correct
35 Correct 15 ms 256 KB Output is correct
36 Correct 27 ms 256 KB Output is correct
37 Correct 10 ms 256 KB Output is correct
38 Correct 10 ms 256 KB Output is correct
39 Correct 47 ms 256 KB Output is correct
40 Partially correct 41 ms 376 KB Partially correct - number of queries: 8087
41 Partially correct 51 ms 256 KB Partially correct - number of queries: 6004
42 Partially correct 33 ms 384 KB Partially correct - number of queries: 6004
43 Partially correct 42 ms 256 KB Partially correct - number of queries: 5513
44 Correct 23 ms 376 KB Output is correct
45 Correct 43 ms 256 KB Output is correct
46 Correct 11 ms 256 KB Output is correct
47 Partially correct 48 ms 256 KB Partially correct - number of queries: 5087
48 Partially correct 58 ms 256 KB Partially correct - number of queries: 7194
49 Correct 17 ms 256 KB Output is correct
50 Partially correct 97 ms 288 KB Partially correct - number of queries: 9363
51 Correct 41 ms 256 KB Output is correct
52 Correct 12 ms 256 KB Output is correct
53 Correct 14 ms 256 KB Output is correct
54 Correct 38 ms 256 KB Output is correct
55 Correct 8 ms 376 KB Output is correct
56 Partially correct 58 ms 384 KB Partially correct - number of queries: 9363
57 Partially correct 66 ms 256 KB Partially correct - number of queries: 7106
58 Partially correct 37 ms 376 KB Partially correct - number of queries: 7212
59 Partially correct 63 ms 256 KB Partially correct - number of queries: 6004
60 Partially correct 45 ms 256 KB Partially correct - number of queries: 5642
61 Correct 15 ms 256 KB Output is correct
62 Correct 13 ms 256 KB Output is correct
63 Correct 15 ms 256 KB Output is correct
64 Correct 13 ms 256 KB Output is correct
65 Correct 12 ms 256 KB Output is correct
66 Correct 16 ms 380 KB Output is correct
67 Correct 6 ms 384 KB Output is correct
68 Correct 40 ms 256 KB Output is correct
69 Correct 38 ms 256 KB Output is correct
70 Correct 14 ms 256 KB Output is correct
71 Partially correct 69 ms 256 KB Partially correct - number of queries: 9359
72 Correct 20 ms 256 KB Output is correct
73 Partially correct 52 ms 256 KB Partially correct - number of queries: 9234
74 Partially correct 104 ms 384 KB Partially correct - number of queries: 9288
75 Correct 10 ms 256 KB Output is correct
76 Partially correct 98 ms 256 KB Partially correct - number of queries: 8084
77 Partially correct 77 ms 256 KB Partially correct - number of queries: 9359
78 Correct 13 ms 256 KB Output is correct
79 Correct 60 ms 256 KB Output is correct
80 Partially correct 84 ms 256 KB Partially correct - number of queries: 9359
81 Partially correct 90 ms 256 KB Partially correct - number of queries: 9359
82 Partially correct 74 ms 256 KB Partially correct - number of queries: 9253
83 Correct 14 ms 256 KB Output is correct
84 Partially correct 76 ms 256 KB Partially correct - number of queries: 7802
85 Partially correct 102 ms 256 KB Partially correct - number of queries: 9359
86 Partially correct 97 ms 256 KB Partially correct - number of queries: 7737
87 Correct 17 ms 256 KB Output is correct
88 Correct 19 ms 256 KB Output is correct
89 Partially correct 70 ms 256 KB Partially correct - number of queries: 7682
90 Correct 10 ms 256 KB Output is correct
91 Partially correct 47 ms 256 KB Partially correct - number of queries: 5394
92 Correct 13 ms 256 KB Output is correct
93 Partially correct 78 ms 256 KB Partially correct - number of queries: 9059
94 Partially correct 94 ms 256 KB Partially correct - number of queries: 9450
95 Partially correct 74 ms 256 KB Partially correct - number of queries: 9439
96 Partially correct 82 ms 256 KB Partially correct - number of queries: 9364
97 Partially correct 51 ms 384 KB Partially correct - number of queries: 8591