답안 #1030949

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1030949 2024-07-22T12:47:12 Z coolboy19521 커다란 상품 (IOI17_prize) C++17
90 / 100
66 ms 428 KB
#include "prize.h"
#include "iostream"
 
using namespace std;
 
int find_best(int n) {
    int mx = 0;
    for (int i = 0; i < min(n, 500); i ++) {
        auto pr = ask(i);
        mx = max(mx, pr[0] + pr[1]);
        if (0 == pr[0] + pr[1]) return i;
    }
    int ls = 500;
    for (; ls < n; ls ++) {
        int ps = -1;
        for (; ls < n; ls ++) {
            auto pr = ask(ls);
            int sm = pr[0] + pr[1];
            if (0 == sm) return ls;
            if (sm == mx) {
                ps = pr[1];
                break;
            }
        }
        int rs = n;
        while (1 < rs - ls) {
            int mi = (ls + rs) / 2;
            auto pr = ask(mi);
            int sm = pr[0] + pr[1];
            if (0 == sm) return mi;
            if (sm != mx) rs = mi;
            if (0 == ps - pr[1]) ls = mi;
            else rs = mi;
        }
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 2 ms 344 KB Output is correct
8 Correct 3 ms 344 KB Output is correct
9 Correct 3 ms 344 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 2 ms 356 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 4 ms 344 KB Output is correct
8 Correct 3 ms 344 KB Output is correct
9 Correct 3 ms 344 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
11 Correct 4 ms 344 KB Output is correct
12 Correct 4 ms 344 KB Output is correct
13 Correct 6 ms 344 KB Output is correct
14 Correct 5 ms 344 KB Output is correct
15 Correct 8 ms 344 KB Output is correct
16 Partially correct 34 ms 344 KB Partially correct - number of queries: 7812
17 Correct 2 ms 344 KB Output is correct
18 Partially correct 49 ms 344 KB Partially correct - number of queries: 9089
19 Correct 2 ms 340 KB Output is correct
20 Correct 11 ms 344 KB Output is correct
21 Correct 24 ms 344 KB Output is correct
22 Correct 5 ms 344 KB Output is correct
23 Correct 3 ms 344 KB Output is correct
24 Correct 2 ms 344 KB Output is correct
25 Partially correct 25 ms 344 KB Partially correct - number of queries: 5332
26 Partially correct 20 ms 344 KB Partially correct - number of queries: 5268
27 Correct 2 ms 344 KB Output is correct
28 Partially correct 66 ms 344 KB Partially correct - number of queries: 8647
29 Partially correct 26 ms 344 KB Partially correct - number of queries: 6682
30 Partially correct 54 ms 344 KB Partially correct - number of queries: 9030
31 Correct 4 ms 344 KB Output is correct
32 Correct 4 ms 344 KB Output is correct
33 Correct 0 ms 344 KB Output is correct
34 Correct 15 ms 428 KB Output is correct
35 Correct 3 ms 344 KB Output is correct
36 Correct 12 ms 344 KB Output is correct
37 Correct 3 ms 344 KB Output is correct
38 Correct 3 ms 344 KB Output is correct
39 Correct 20 ms 344 KB Output is correct
40 Partially correct 29 ms 344 KB Partially correct - number of queries: 7786
41 Partially correct 23 ms 344 KB Partially correct - number of queries: 5621
42 Partially correct 30 ms 344 KB Partially correct - number of queries: 5621
43 Partially correct 36 ms 344 KB Partially correct - number of queries: 5128
44 Correct 18 ms 344 KB Output is correct
45 Correct 15 ms 344 KB Output is correct
46 Correct 2 ms 344 KB Output is correct
47 Correct 13 ms 344 KB Output is correct
48 Partially correct 42 ms 344 KB Partially correct - number of queries: 6844
49 Correct 4 ms 344 KB Output is correct
50 Partially correct 44 ms 344 KB Partially correct - number of queries: 9086
51 Correct 19 ms 344 KB Output is correct
52 Correct 3 ms 344 KB Output is correct
53 Correct 2 ms 344 KB Output is correct
54 Correct 21 ms 344 KB Output is correct
55 Correct 2 ms 344 KB Output is correct
56 Partially correct 34 ms 344 KB Partially correct - number of queries: 9088
57 Partially correct 37 ms 344 KB Partially correct - number of queries: 6767
58 Partially correct 28 ms 344 KB Partially correct - number of queries: 6872
59 Partially correct 17 ms 344 KB Partially correct - number of queries: 5621
60 Partially correct 26 ms 344 KB Partially correct - number of queries: 5259
61 Correct 2 ms 344 KB Output is correct
62 Correct 2 ms 344 KB Output is correct
63 Correct 3 ms 344 KB Output is correct
64 Correct 2 ms 344 KB Output is correct
65 Correct 4 ms 344 KB Output is correct
66 Correct 3 ms 344 KB Output is correct
67 Correct 3 ms 344 KB Output is correct
68 Correct 3 ms 344 KB Output is correct
69 Correct 6 ms 344 KB Output is correct
70 Correct 2 ms 344 KB Output is correct
71 Partially correct 41 ms 344 KB Partially correct - number of queries: 9227
72 Correct 3 ms 344 KB Output is correct
73 Partially correct 41 ms 344 KB Partially correct - number of queries: 9111
74 Partially correct 33 ms 344 KB Partially correct - number of queries: 9163
75 Correct 3 ms 344 KB Output is correct
76 Partially correct 54 ms 344 KB Partially correct - number of queries: 7959
77 Partially correct 40 ms 344 KB Partially correct - number of queries: 9111
78 Correct 3 ms 344 KB Output is correct
79 Correct 14 ms 344 KB Output is correct
80 Partially correct 51 ms 344 KB Partially correct - number of queries: 9137
81 Partially correct 53 ms 344 KB Partially correct - number of queries: 9100
82 Partially correct 39 ms 344 KB Partially correct - number of queries: 9031
83 Correct 3 ms 344 KB Output is correct
84 Partially correct 34 ms 344 KB Partially correct - number of queries: 7494
85 Partially correct 40 ms 344 KB Partially correct - number of queries: 9102
86 Correct 3 ms 344 KB Output is correct
87 Correct 3 ms 344 KB Output is correct
88 Correct 3 ms 344 KB Output is correct
89 Correct 3 ms 344 KB Output is correct
90 Correct 3 ms 344 KB Output is correct
91 Correct 2 ms 344 KB Output is correct
92 Correct 3 ms 344 KB Output is correct
93 Correct 3 ms 344 KB Output is correct
94 Correct 3 ms 344 KB Output is correct
95 Correct 3 ms 344 KB Output is correct
96 Correct 4 ms 344 KB Output is correct
97 Correct 4 ms 344 KB Output is correct