답안 #713928

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
713928 2023-03-23T09:12:27 Z stevancv Brunhilda’s Birthday (BOI13_brunhilda) C++14
77.4603 / 100
389 ms 80004 KB
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define sp ' '
#define en '\n'
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
using namespace std;
const int N = 1e5 + 2;
const int M = 1e7 + 2;
const int inf = 1e9;
int dp[M], gde[M];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, q;
    cin >> n >> q;
    for (int i = 0; i < n; i++) {
        int x; cin >> x;
        for (int j = x - 1; j < M; j += x) gde[j] = x - 1;
    }
    for (int i = M - 2; i >= 1; i--) {
        smax(gde[i], gde[i + 1] - 1);
    }
    for (int i = 1; i < M; i++) {
        dp[i] = inf;
        if (dp[i - gde[i]] != inf) dp[i] = dp[i - gde[i]] + 1;
    }
    for (int i = 1; i <= q; i++) {
        int x; cin >> x;
        if (dp[x] == inf) cout << "oo" << en;
        else cout << dp[x] << en;
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 81 ms 78620 KB Output is correct
2 Correct 95 ms 78488 KB Output is correct
3 Correct 98 ms 78540 KB Output is correct
4 Correct 86 ms 78628 KB Output is correct
5 Correct 92 ms 78480 KB Output is correct
6 Correct 84 ms 78488 KB Output is correct
7 Correct 90 ms 78560 KB Output is correct
8 Correct 93 ms 78484 KB Output is correct
9 Correct 106 ms 78488 KB Output is correct
10 Correct 118 ms 78488 KB Output is correct
11 Correct 115 ms 78492 KB Output is correct
12 Correct 88 ms 78528 KB Output is correct
13 Correct 188 ms 78492 KB Output is correct
14 Correct 176 ms 78532 KB Output is correct
15 Correct 113 ms 78500 KB Output is correct
16 Correct 104 ms 78484 KB Output is correct
17 Correct 97 ms 78540 KB Output is correct
18 Correct 83 ms 78536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 94 ms 78568 KB Output is correct
2 Correct 109 ms 79256 KB Output is correct
3 Correct 218 ms 79044 KB Output is correct
4 Correct 104 ms 78512 KB Output is correct
5 Correct 158 ms 78900 KB Output is correct
6 Correct 137 ms 78488 KB Output is correct
7 Correct 96 ms 78644 KB Output is correct
8 Correct 101 ms 78540 KB Output is correct
9 Correct 179 ms 79048 KB Output is correct
10 Correct 236 ms 78952 KB Output is correct
11 Incorrect 219 ms 78816 KB Output isn't correct
12 Correct 127 ms 78496 KB Output is correct
13 Correct 97 ms 78636 KB Output is correct
14 Correct 119 ms 78500 KB Output is correct
15 Correct 171 ms 78764 KB Output is correct
16 Correct 105 ms 79176 KB Output is correct
17 Correct 188 ms 78516 KB Output is correct
18 Correct 212 ms 79304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 182 ms 79308 KB Output is correct
2 Correct 216 ms 79104 KB Output is correct
3 Correct 242 ms 79492 KB Output is correct
4 Incorrect 150 ms 79488 KB Output isn't correct
5 Incorrect 144 ms 79988 KB Output isn't correct
6 Correct 191 ms 79556 KB Output is correct
7 Correct 171 ms 79748 KB Output is correct
8 Correct 196 ms 79304 KB Output is correct
9 Correct 206 ms 79296 KB Output is correct
10 Correct 147 ms 78656 KB Output is correct
11 Incorrect 134 ms 78784 KB Output isn't correct
12 Correct 199 ms 78784 KB Output is correct
13 Correct 206 ms 79696 KB Output is correct
14 Correct 150 ms 79812 KB Output is correct
15 Incorrect 221 ms 78872 KB Output isn't correct
16 Correct 186 ms 78916 KB Output is correct
17 Correct 242 ms 79044 KB Output is correct
18 Correct 389 ms 79168 KB Output is correct
19 Incorrect 129 ms 78852 KB Output isn't correct
20 Correct 372 ms 79436 KB Output is correct
21 Incorrect 249 ms 79964 KB Output isn't correct
22 Correct 379 ms 79932 KB Output is correct
23 Correct 169 ms 79688 KB Output is correct
24 Correct 127 ms 79556 KB Output is correct
25 Incorrect 174 ms 79540 KB Output isn't correct
26 Incorrect 153 ms 79436 KB Output isn't correct
27 Correct 241 ms 79748 KB Output is correct
28 Incorrect 117 ms 79516 KB Output isn't correct
29 Correct 237 ms 79940 KB Output is correct
30 Correct 198 ms 80004 KB Output is correct
31 Correct 124 ms 79504 KB Output is correct
32 Incorrect 133 ms 79496 KB Output isn't correct
33 Incorrect 108 ms 79428 KB Output isn't correct
34 Correct 172 ms 79812 KB Output is correct
35 Incorrect 121 ms 79564 KB Output isn't correct
36 Correct 224 ms 79968 KB Output is correct
37 Incorrect 134 ms 79892 KB Output isn't correct
38 Correct 235 ms 79556 KB Output is correct
39 Incorrect 117 ms 79616 KB Output isn't correct
40 Correct 185 ms 79480 KB Output is correct
41 Correct 168 ms 79820 KB Output is correct
42 Incorrect 214 ms 79680 KB Output isn't correct