답안 #713946

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
713946 2023-03-23T09:52:43 Z stevancv Brunhilda’s Birthday (BOI13_brunhilda) C++14
77.4603 / 100
270 ms 79180 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 = 1; 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++) {
        if (gde[i] > 0) dp[i] = dp[i - gde[i]] + 1;
        else dp[i] = inf;
    }
    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 88 ms 78484 KB Output is correct
2 Correct 93 ms 78484 KB Output is correct
3 Correct 85 ms 78484 KB Output is correct
4 Correct 83 ms 78588 KB Output is correct
5 Correct 88 ms 78476 KB Output is correct
6 Correct 82 ms 78480 KB Output is correct
7 Correct 90 ms 78476 KB Output is correct
8 Correct 106 ms 78528 KB Output is correct
9 Correct 138 ms 78480 KB Output is correct
10 Correct 168 ms 78488 KB Output is correct
11 Correct 146 ms 78540 KB Output is correct
12 Correct 97 ms 78476 KB Output is correct
13 Correct 270 ms 78484 KB Output is correct
14 Correct 245 ms 78484 KB Output is correct
15 Correct 144 ms 78484 KB Output is correct
16 Correct 101 ms 78484 KB Output is correct
17 Correct 101 ms 78496 KB Output is correct
18 Correct 81 ms 78540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 91 ms 78496 KB Output is correct
2 Correct 101 ms 78492 KB Output is correct
3 Correct 209 ms 78484 KB Output is correct
4 Correct 112 ms 78496 KB Output is correct
5 Correct 152 ms 78544 KB Output is correct
6 Correct 94 ms 78480 KB Output is correct
7 Correct 92 ms 78484 KB Output is correct
8 Correct 112 ms 78480 KB Output is correct
9 Correct 176 ms 78572 KB Output is correct
10 Correct 206 ms 78508 KB Output is correct
11 Incorrect 198 ms 78488 KB Output isn't correct
12 Correct 126 ms 78540 KB Output is correct
13 Correct 88 ms 78484 KB Output is correct
14 Correct 107 ms 78488 KB Output is correct
15 Correct 172 ms 78480 KB Output is correct
16 Correct 119 ms 78544 KB Output is correct
17 Correct 183 ms 78480 KB Output is correct
18 Correct 176 ms 78480 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 179 ms 78588 KB Output is correct
2 Correct 224 ms 78612 KB Output is correct
3 Correct 238 ms 78744 KB Output is correct
4 Incorrect 159 ms 78740 KB Output isn't correct
5 Incorrect 124 ms 78756 KB Output isn't correct
6 Correct 192 ms 78740 KB Output is correct
7 Correct 193 ms 78616 KB Output is correct
8 Correct 190 ms 78632 KB Output is correct
9 Correct 199 ms 78624 KB Output is correct
10 Correct 142 ms 78612 KB Output is correct
11 Incorrect 145 ms 78540 KB Output isn't correct
12 Correct 173 ms 78612 KB Output is correct
13 Correct 208 ms 78796 KB Output is correct
14 Correct 142 ms 79124 KB Output is correct
15 Incorrect 181 ms 78616 KB Output isn't correct
16 Correct 185 ms 78648 KB Output is correct
17 Correct 169 ms 78540 KB Output is correct
18 Correct 208 ms 78716 KB Output is correct
19 Incorrect 91 ms 78540 KB Output isn't correct
20 Correct 211 ms 78652 KB Output is correct
21 Incorrect 154 ms 79180 KB Output isn't correct
22 Correct 229 ms 78744 KB Output is correct
23 Correct 125 ms 78740 KB Output is correct
24 Correct 107 ms 78748 KB Output is correct
25 Incorrect 169 ms 78872 KB Output isn't correct
26 Incorrect 148 ms 78796 KB Output isn't correct
27 Correct 233 ms 78612 KB Output is correct
28 Incorrect 106 ms 78864 KB Output isn't correct
29 Correct 219 ms 78744 KB Output is correct
30 Correct 203 ms 78796 KB Output is correct
31 Correct 121 ms 78748 KB Output is correct
32 Incorrect 138 ms 78796 KB Output isn't correct
33 Incorrect 109 ms 78772 KB Output isn't correct
34 Correct 165 ms 78572 KB Output is correct
35 Incorrect 106 ms 78868 KB Output isn't correct
36 Correct 228 ms 78752 KB Output is correct
37 Incorrect 124 ms 78732 KB Output isn't correct
38 Correct 184 ms 78736 KB Output is correct
39 Incorrect 118 ms 78748 KB Output isn't correct
40 Correct 163 ms 78752 KB Output is correct
41 Correct 151 ms 78656 KB Output is correct
42 Incorrect 192 ms 78880 KB Output isn't correct