답안 #597868

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
597868 2022-07-17T02:44:59 Z yanndev 커다란 상품 (IOI17_prize) C++17
90 / 100
107 ms 5140 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
 
vector<int> ans[200042];
 
vector<int> query(int i) {
    if (ans[i].empty())
        return ans[i] = ask(i);
    return ans[i];
}
 
int find_best(int n) {
    int mxVal = 0;
    for (int i = 0; i < min(n, 500); i++) {
        auto x = query(i);
        mxVal = max(mxVal, x[0] + x[1]);
    }

    for (int i = 0; i < n; i++) {
        vector<int> a = query(i);
        if (a[0] == 0 && a[1] == 0)
            return i;
        if (a[0] + a[1] < mxVal)
            continue;
        
        int l = i;
        int r = n;
        while (l < r) {
            int m = (l + r + 1) / 2;
            vector<int> b = ask(m);
            if (b[0] == a[0] && b[1] == a[1])
                l = m;
            else
                r = m - 1;
        }

		//cout << "poor range " << i << ' ' << l << '\n';
        i = l;
    }

    return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 4992 KB Output is correct
2 Correct 7 ms 4988 KB Output is correct
3 Correct 6 ms 4944 KB Output is correct
4 Correct 7 ms 4996 KB Output is correct
5 Correct 7 ms 5116 KB Output is correct
6 Correct 6 ms 4984 KB Output is correct
7 Correct 7 ms 4988 KB Output is correct
8 Correct 5 ms 4944 KB Output is correct
9 Correct 8 ms 4944 KB Output is correct
10 Correct 7 ms 5004 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 4988 KB Output is correct
2 Correct 8 ms 4976 KB Output is correct
3 Correct 8 ms 4992 KB Output is correct
4 Correct 8 ms 4980 KB Output is correct
5 Correct 7 ms 4944 KB Output is correct
6 Correct 6 ms 4928 KB Output is correct
7 Correct 6 ms 5004 KB Output is correct
8 Correct 6 ms 5008 KB Output is correct
9 Correct 7 ms 4988 KB Output is correct
10 Correct 9 ms 5008 KB Output is correct
11 Correct 7 ms 5116 KB Output is correct
12 Correct 8 ms 4944 KB Output is correct
13 Correct 15 ms 4944 KB Output is correct
14 Correct 11 ms 4944 KB Output is correct
15 Correct 15 ms 5012 KB Output is correct
16 Partially correct 66 ms 5020 KB Partially correct - number of queries: 7830
17 Correct 8 ms 4980 KB Output is correct
18 Partially correct 95 ms 5012 KB Partially correct - number of queries: 9103
19 Correct 6 ms 4980 KB Output is correct
20 Correct 23 ms 4944 KB Output is correct
21 Correct 32 ms 5124 KB Output is correct
22 Correct 8 ms 5108 KB Output is correct
23 Correct 8 ms 4992 KB Output is correct
24 Correct 7 ms 4980 KB Output is correct
25 Partially correct 27 ms 5004 KB Partially correct - number of queries: 5366
26 Partially correct 25 ms 5140 KB Partially correct - number of queries: 5286
27 Correct 7 ms 4984 KB Output is correct
28 Partially correct 55 ms 5016 KB Partially correct - number of queries: 8663
29 Partially correct 47 ms 5008 KB Partially correct - number of queries: 6702
30 Partially correct 76 ms 5128 KB Partially correct - number of queries: 9049
31 Correct 9 ms 4992 KB Output is correct
32 Correct 10 ms 4944 KB Output is correct
33 Correct 3 ms 5000 KB Output is correct
34 Correct 36 ms 5000 KB Output is correct
35 Correct 10 ms 4988 KB Output is correct
36 Correct 19 ms 4984 KB Output is correct
37 Correct 10 ms 4944 KB Output is correct
38 Correct 9 ms 4992 KB Output is correct
39 Correct 22 ms 5012 KB Output is correct
40 Partially correct 80 ms 5108 KB Partially correct - number of queries: 7803
41 Partially correct 53 ms 5008 KB Partially correct - number of queries: 5646
42 Partially correct 54 ms 5072 KB Partially correct - number of queries: 5646
43 Partially correct 46 ms 5132 KB Partially correct - number of queries: 5144
44 Correct 37 ms 5000 KB Output is correct
45 Correct 32 ms 4992 KB Output is correct
46 Correct 7 ms 4988 KB Output is correct
47 Correct 26 ms 5004 KB Output is correct
48 Partially correct 61 ms 5008 KB Partially correct - number of queries: 6862
49 Correct 14 ms 4944 KB Output is correct
50 Partially correct 73 ms 5072 KB Partially correct - number of queries: 9103
51 Correct 18 ms 5108 KB Output is correct
52 Correct 7 ms 4996 KB Output is correct
53 Correct 10 ms 4988 KB Output is correct
54 Correct 19 ms 5000 KB Output is correct
55 Correct 6 ms 5088 KB Output is correct
56 Partially correct 37 ms 5096 KB Partially correct - number of queries: 9108
57 Partially correct 34 ms 5016 KB Partially correct - number of queries: 6785
58 Partially correct 42 ms 5136 KB Partially correct - number of queries: 6892
59 Partially correct 39 ms 5004 KB Partially correct - number of queries: 5646
60 Partially correct 40 ms 4996 KB Partially correct - number of queries: 5277
61 Correct 9 ms 4992 KB Output is correct
62 Correct 6 ms 4988 KB Output is correct
63 Correct 5 ms 5072 KB Output is correct
64 Correct 9 ms 4944 KB Output is correct
65 Correct 8 ms 4944 KB Output is correct
66 Correct 13 ms 4988 KB Output is correct
67 Correct 10 ms 4984 KB Output is correct
68 Correct 5 ms 4996 KB Output is correct
69 Correct 12 ms 4944 KB Output is correct
70 Correct 7 ms 4988 KB Output is correct
71 Partially correct 75 ms 5008 KB Partially correct - number of queries: 9238
72 Correct 14 ms 5000 KB Output is correct
73 Partially correct 72 ms 5012 KB Partially correct - number of queries: 9112
74 Partially correct 74 ms 5008 KB Partially correct - number of queries: 9162
75 Correct 8 ms 4944 KB Output is correct
76 Partially correct 61 ms 5000 KB Partially correct - number of queries: 7938
77 Partially correct 107 ms 5016 KB Partially correct - number of queries: 9133
78 Correct 13 ms 4944 KB Output is correct
79 Correct 33 ms 5000 KB Output is correct
80 Partially correct 84 ms 4996 KB Partially correct - number of queries: 9112
81 Partially correct 73 ms 5012 KB Partially correct - number of queries: 9097
82 Partially correct 84 ms 5064 KB Partially correct - number of queries: 9053
83 Correct 6 ms 4992 KB Output is correct
84 Partially correct 72 ms 5012 KB Partially correct - number of queries: 7549
85 Partially correct 79 ms 5000 KB Partially correct - number of queries: 9142
86 Correct 10 ms 4944 KB Output is correct
87 Correct 7 ms 4944 KB Output is correct
88 Correct 8 ms 4944 KB Output is correct
89 Correct 7 ms 4928 KB Output is correct
90 Correct 9 ms 4992 KB Output is correct
91 Correct 6 ms 5000 KB Output is correct
92 Correct 5 ms 4944 KB Output is correct
93 Correct 9 ms 4944 KB Output is correct
94 Correct 12 ms 5016 KB Output is correct
95 Correct 13 ms 5008 KB Output is correct
96 Correct 11 ms 5008 KB Output is correct
97 Correct 7 ms 5000 KB Output is correct