Submission #713874

# Submission time Handle Problem Language Result Execution time Memory
713874 2023-03-23T06:44:03 Z stevancv Brunhilda’s Birthday (BOI13_brunhilda) C++14
0 / 100
258 ms 80464 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] - i);
        dp[i] = inf;
    }
    for (int i = 1; i < M; i++) {
        if (dp[i - gde[i]] != inf) dp[i] = dp[i - gde[i]] + 1;
        else dp[i] = inf;
    }
    for (int i = 1; i <= q; i++) {
        int x; cin >> x;
        if (dp[i] == inf) cout << "oo" << en;
        else cout << dp[i] << en;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 89 ms 78540 KB Output isn't correct
2 Incorrect 101 ms 78524 KB Output isn't correct
3 Incorrect 87 ms 78464 KB Output isn't correct
4 Incorrect 86 ms 78560 KB Output isn't correct
5 Incorrect 99 ms 78472 KB Output isn't correct
6 Incorrect 88 ms 78544 KB Output isn't correct
7 Incorrect 100 ms 78528 KB Output isn't correct
8 Incorrect 92 ms 78616 KB Output isn't correct
9 Incorrect 106 ms 78488 KB Output isn't correct
10 Incorrect 128 ms 78620 KB Output isn't correct
11 Incorrect 133 ms 78488 KB Output isn't correct
12 Incorrect 90 ms 78576 KB Output isn't correct
13 Incorrect 172 ms 78596 KB Output isn't correct
14 Incorrect 187 ms 78668 KB Output isn't correct
15 Incorrect 112 ms 78488 KB Output isn't correct
16 Incorrect 94 ms 78484 KB Output isn't correct
17 Incorrect 94 ms 78600 KB Output isn't correct
18 Incorrect 82 ms 78544 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 95 ms 78776 KB Output isn't correct
2 Incorrect 115 ms 79160 KB Output isn't correct
3 Incorrect 216 ms 79048 KB Output isn't correct
4 Incorrect 106 ms 78600 KB Output isn't correct
5 Incorrect 172 ms 78916 KB Output isn't correct
6 Incorrect 94 ms 78512 KB Output isn't correct
7 Incorrect 94 ms 78588 KB Output isn't correct
8 Incorrect 113 ms 78488 KB Output isn't correct
9 Incorrect 195 ms 79060 KB Output isn't correct
10 Incorrect 258 ms 78924 KB Output isn't correct
11 Incorrect 204 ms 78792 KB Output isn't correct
12 Incorrect 129 ms 78496 KB Output isn't correct
13 Incorrect 86 ms 78540 KB Output isn't correct
14 Incorrect 105 ms 78600 KB Output isn't correct
15 Incorrect 205 ms 78864 KB Output isn't correct
16 Incorrect 121 ms 79292 KB Output isn't correct
17 Incorrect 179 ms 78588 KB Output isn't correct
18 Incorrect 196 ms 79300 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 200 ms 79368 KB Output isn't correct
2 Incorrect 243 ms 79080 KB Output isn't correct
3 Incorrect 244 ms 79428 KB Output isn't correct
4 Incorrect 142 ms 79496 KB Output isn't correct
5 Incorrect 144 ms 80372 KB Output isn't correct
6 Incorrect 179 ms 79560 KB Output isn't correct
7 Incorrect 195 ms 79944 KB Output isn't correct
8 Incorrect 196 ms 79296 KB Output isn't correct
9 Incorrect 187 ms 79232 KB Output isn't correct
10 Incorrect 151 ms 78620 KB Output isn't correct
11 Incorrect 128 ms 78804 KB Output isn't correct
12 Incorrect 170 ms 78824 KB Output isn't correct
13 Incorrect 214 ms 79816 KB Output isn't correct
14 Incorrect 149 ms 79556 KB Output isn't correct
15 Incorrect 177 ms 78828 KB Output isn't correct
16 Incorrect 211 ms 78788 KB Output isn't correct
17 Incorrect 185 ms 78920 KB Output isn't correct
18 Incorrect 210 ms 79080 KB Output isn't correct
19 Incorrect 92 ms 78788 KB Output isn't correct
20 Incorrect 233 ms 79368 KB Output isn't correct
21 Incorrect 153 ms 79556 KB Output isn't correct
22 Incorrect 238 ms 80372 KB Output isn't correct
23 Incorrect 125 ms 79820 KB Output isn't correct
24 Incorrect 100 ms 79500 KB Output isn't correct
25 Incorrect 163 ms 79552 KB Output isn't correct
26 Incorrect 147 ms 79424 KB Output isn't correct
27 Incorrect 252 ms 79744 KB Output isn't correct
28 Incorrect 106 ms 79564 KB Output isn't correct
29 Incorrect 231 ms 80336 KB Output isn't correct
30 Incorrect 206 ms 80072 KB Output isn't correct
31 Incorrect 113 ms 79492 KB Output isn't correct
32 Incorrect 128 ms 79484 KB Output isn't correct
33 Incorrect 94 ms 79564 KB Output isn't correct
34 Incorrect 182 ms 79972 KB Output isn't correct
35 Incorrect 113 ms 79584 KB Output isn't correct
36 Incorrect 237 ms 80304 KB Output isn't correct
37 Incorrect 135 ms 80464 KB Output isn't correct
38 Incorrect 180 ms 79560 KB Output isn't correct
39 Incorrect 111 ms 79556 KB Output isn't correct
40 Incorrect 161 ms 79504 KB Output isn't correct
41 Incorrect 177 ms 79848 KB Output isn't correct
42 Incorrect 232 ms 79600 KB Output isn't correct