답안 #713259

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
713259 2023-03-21T14:10:21 Z tht2005 커다란 상품 (IOI17_prize) C++17
90 / 100
81 ms 336 KB
#include "prize.h"

int find_best(int n) {
    int big = 0;
    std::vector<int> q_big(2, -1);
    for(int i = 0; i < n && i < 500; ++i) {
        std::vector<int> q = ask(i);
        if(q[0] == 0 && q[1] == 0) {
            return i;
        }
        if(q_big[0] + q_big[1] <= q[0] + q[1]) {
            big = i;
            q_big = q;
        }
    }
    while(big + 1 < n) {
        int l = big + 1, r = n - 1;
        while(l <= r) {
            int mid = (l + r) >> 1;
            std::vector<int> q = ask(mid);
            if(q[0] + q[1] < q_big[0] + q_big[1] || q[1] < q_big[1]) {
                r = mid - 1;
            }
            else {
                big = mid;
                l = mid + 1;
            }
        }
        for(int i = big + 1; i < n; ++i) {
            std::vector<int> q = ask(i);
            if(q[0] == 0 && q[1] == 0) {
                return i;
            }
            if(q[0] + q[1] == q_big[0] + q_big[1]) {
                big = i;
                q_big = q;
                break;
            }
        }
    }
}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:5:33: warning: control reaches end of non-void function [-Wreturn-type]
    5 |     std::vector<int> q_big(2, -1);
      |                                 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 208 KB Output is correct
2 Correct 3 ms 208 KB Output is correct
3 Correct 4 ms 292 KB Output is correct
4 Correct 5 ms 208 KB Output is correct
5 Correct 5 ms 208 KB Output is correct
6 Correct 1 ms 268 KB Output is correct
7 Correct 3 ms 288 KB Output is correct
8 Correct 5 ms 288 KB Output is correct
9 Correct 5 ms 284 KB Output is correct
10 Correct 5 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 208 KB Output is correct
2 Correct 5 ms 208 KB Output is correct
3 Correct 5 ms 292 KB Output is correct
4 Correct 5 ms 208 KB Output is correct
5 Correct 4 ms 288 KB Output is correct
6 Correct 1 ms 284 KB Output is correct
7 Correct 4 ms 208 KB Output is correct
8 Correct 3 ms 292 KB Output is correct
9 Correct 4 ms 208 KB Output is correct
10 Correct 5 ms 208 KB Output is correct
11 Correct 7 ms 288 KB Output is correct
12 Correct 4 ms 208 KB Output is correct
13 Correct 8 ms 208 KB Output is correct
14 Correct 9 ms 208 KB Output is correct
15 Correct 11 ms 288 KB Output is correct
16 Partially correct 71 ms 208 KB Partially correct - number of queries: 7812
17 Correct 5 ms 296 KB Output is correct
18 Partially correct 70 ms 292 KB Partially correct - number of queries: 9088
19 Correct 5 ms 296 KB Output is correct
20 Correct 11 ms 336 KB Output is correct
21 Correct 17 ms 268 KB Output is correct
22 Correct 13 ms 208 KB Output is correct
23 Correct 5 ms 292 KB Output is correct
24 Correct 6 ms 208 KB Output is correct
25 Partially correct 49 ms 288 KB Partially correct - number of queries: 5332
26 Partially correct 24 ms 292 KB Partially correct - number of queries: 5269
27 Correct 6 ms 208 KB Output is correct
28 Partially correct 45 ms 292 KB Partially correct - number of queries: 8646
29 Partially correct 45 ms 208 KB Partially correct - number of queries: 6688
30 Partially correct 34 ms 288 KB Partially correct - number of queries: 9031
31 Correct 3 ms 292 KB Output is correct
32 Correct 4 ms 292 KB Output is correct
33 Correct 0 ms 208 KB Output is correct
34 Correct 27 ms 208 KB Output is correct
35 Correct 6 ms 288 KB Output is correct
36 Correct 20 ms 208 KB Output is correct
37 Correct 5 ms 296 KB Output is correct
38 Correct 4 ms 208 KB Output is correct
39 Correct 43 ms 208 KB Output is correct
40 Partially correct 53 ms 208 KB Partially correct - number of queries: 7785
41 Partially correct 22 ms 288 KB Partially correct - number of queries: 5628
42 Partially correct 62 ms 288 KB Partially correct - number of queries: 5628
43 Partially correct 52 ms 208 KB Partially correct - number of queries: 5127
44 Correct 32 ms 208 KB Output is correct
45 Correct 27 ms 208 KB Output is correct
46 Correct 2 ms 292 KB Output is correct
47 Correct 35 ms 288 KB Output is correct
48 Partially correct 37 ms 208 KB Partially correct - number of queries: 6844
49 Correct 9 ms 296 KB Output is correct
50 Partially correct 61 ms 288 KB Partially correct - number of queries: 9085
51 Correct 43 ms 208 KB Output is correct
52 Correct 6 ms 208 KB Output is correct
53 Correct 3 ms 292 KB Output is correct
54 Correct 36 ms 208 KB Output is correct
55 Correct 4 ms 208 KB Output is correct
56 Partially correct 38 ms 292 KB Partially correct - number of queries: 9087
57 Partially correct 57 ms 208 KB Partially correct - number of queries: 6768
58 Partially correct 48 ms 208 KB Partially correct - number of queries: 6874
59 Partially correct 48 ms 208 KB Partially correct - number of queries: 5628
60 Partially correct 41 ms 208 KB Partially correct - number of queries: 5260
61 Correct 6 ms 208 KB Output is correct
62 Correct 4 ms 208 KB Output is correct
63 Correct 5 ms 296 KB Output is correct
64 Correct 7 ms 208 KB Output is correct
65 Correct 6 ms 288 KB Output is correct
66 Correct 7 ms 288 KB Output is correct
67 Correct 4 ms 292 KB Output is correct
68 Correct 3 ms 208 KB Output is correct
69 Correct 4 ms 288 KB Output is correct
70 Correct 4 ms 208 KB Output is correct
71 Partially correct 68 ms 208 KB Partially correct - number of queries: 9244
72 Correct 11 ms 208 KB Output is correct
73 Partially correct 79 ms 208 KB Partially correct - number of queries: 9115
74 Partially correct 77 ms 208 KB Partially correct - number of queries: 9162
75 Correct 7 ms 208 KB Output is correct
76 Partially correct 74 ms 208 KB Partially correct - number of queries: 7959
77 Partially correct 76 ms 288 KB Partially correct - number of queries: 9119
78 Correct 11 ms 208 KB Output is correct
79 Correct 39 ms 208 KB Output is correct
80 Partially correct 74 ms 208 KB Partially correct - number of queries: 9132
81 Partially correct 35 ms 336 KB Partially correct - number of queries: 9103
82 Partially correct 80 ms 208 KB Partially correct - number of queries: 8899
83 Correct 7 ms 208 KB Output is correct
84 Partially correct 58 ms 208 KB Partially correct - number of queries: 7492
85 Partially correct 81 ms 208 KB Partially correct - number of queries: 9061
86 Correct 2 ms 288 KB Output is correct
87 Correct 6 ms 208 KB Output is correct
88 Correct 6 ms 208 KB Output is correct
89 Correct 5 ms 208 KB Output is correct
90 Correct 3 ms 208 KB Output is correct
91 Correct 4 ms 208 KB Output is correct
92 Correct 5 ms 208 KB Output is correct
93 Correct 9 ms 208 KB Output is correct
94 Correct 9 ms 208 KB Output is correct
95 Correct 8 ms 208 KB Output is correct
96 Correct 7 ms 208 KB Output is correct
97 Correct 5 ms 208 KB Output is correct