답안 #535233

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
535233 2022-03-09T17:54:57 Z MKutayBozkurt Brunhilda’s Birthday (BOI13_brunhilda) C++14
0 / 100
126 ms 262152 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int mx = 2e7 + 5;
int32_t main() {
  ios_base::sync_with_stdio(0); cin.tie(0);
  int n, q; cin >> n >> q;
  vector<int> a(n), d(mx), dp(mx, 1e9);
  for (int &x : a) {
    cin >> x;
    for (int i = x - 1; i <= mx; i += x) {
      d[i] = x - 1;
    }
  }

  for (int i = mx - 2; i > 0; i--) d[i] = max(d[i], d[i + 1] - 1);

  dp[0] = 0;
  for (int i = 1; i <= mx; i++) {
    dp[i] = dp[i - d[i]] + 1;
  }

  while (q--) {
    int x; cin >> x;
    cout << (dp[x] >= 1e9 ? "oo" : to_string(dp[x])) << '\n';
  }
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 114 ms 262148 KB Execution killed with signal 9
2 Runtime error 102 ms 262148 KB Execution killed with signal 9
3 Runtime error 101 ms 262148 KB Execution killed with signal 9
4 Runtime error 108 ms 262148 KB Execution killed with signal 9
5 Runtime error 106 ms 262148 KB Execution killed with signal 9
6 Runtime error 116 ms 262148 KB Execution killed with signal 9
7 Runtime error 101 ms 262148 KB Execution killed with signal 9
8 Runtime error 107 ms 262148 KB Execution killed with signal 9
9 Runtime error 103 ms 262148 KB Execution killed with signal 9
10 Runtime error 102 ms 262148 KB Execution killed with signal 9
11 Runtime error 104 ms 262148 KB Execution killed with signal 9
12 Runtime error 102 ms 262148 KB Execution killed with signal 9
13 Runtime error 97 ms 262148 KB Execution killed with signal 9
14 Runtime error 123 ms 262148 KB Execution killed with signal 9
15 Runtime error 100 ms 262148 KB Execution killed with signal 9
16 Runtime error 96 ms 262148 KB Execution killed with signal 9
17 Runtime error 98 ms 262148 KB Execution killed with signal 9
18 Runtime error 109 ms 262148 KB Execution killed with signal 9
# 결과 실행 시간 메모리 Grader output
1 Runtime error 102 ms 262148 KB Execution killed with signal 9
2 Runtime error 100 ms 262148 KB Execution killed with signal 9
3 Runtime error 121 ms 262148 KB Execution killed with signal 9
4 Runtime error 97 ms 262148 KB Execution killed with signal 9
5 Runtime error 100 ms 262148 KB Execution killed with signal 9
6 Runtime error 99 ms 262148 KB Execution killed with signal 9
7 Runtime error 121 ms 262148 KB Execution killed with signal 9
8 Runtime error 114 ms 262148 KB Execution killed with signal 9
9 Runtime error 99 ms 262148 KB Execution killed with signal 9
10 Runtime error 116 ms 262148 KB Execution killed with signal 9
11 Runtime error 126 ms 262148 KB Execution killed with signal 9
12 Runtime error 95 ms 262148 KB Execution killed with signal 9
13 Runtime error 101 ms 262148 KB Execution killed with signal 9
14 Runtime error 105 ms 262148 KB Execution killed with signal 9
15 Runtime error 96 ms 262148 KB Execution killed with signal 9
16 Runtime error 102 ms 262148 KB Execution killed with signal 9
17 Runtime error 102 ms 262148 KB Execution killed with signal 9
18 Runtime error 103 ms 262148 KB Execution killed with signal 9
# 결과 실행 시간 메모리 Grader output
1 Runtime error 119 ms 262148 KB Execution killed with signal 9
2 Runtime error 101 ms 262148 KB Execution killed with signal 9
3 Runtime error 105 ms 262148 KB Execution killed with signal 9
4 Runtime error 103 ms 262148 KB Execution killed with signal 9
5 Runtime error 101 ms 262148 KB Execution killed with signal 9
6 Runtime error 104 ms 262148 KB Execution killed with signal 9
7 Runtime error 110 ms 262148 KB Execution killed with signal 9
8 Runtime error 103 ms 262148 KB Execution killed with signal 9
9 Runtime error 109 ms 262148 KB Execution killed with signal 9
10 Runtime error 108 ms 262148 KB Execution killed with signal 9
11 Runtime error 98 ms 262148 KB Execution killed with signal 9
12 Runtime error 109 ms 262148 KB Execution killed with signal 9
13 Runtime error 126 ms 262148 KB Execution killed with signal 9
14 Runtime error 99 ms 262148 KB Execution killed with signal 9
15 Runtime error 100 ms 262148 KB Execution killed with signal 9
16 Runtime error 113 ms 262148 KB Execution killed with signal 9
17 Runtime error 106 ms 262148 KB Execution killed with signal 9
18 Runtime error 115 ms 262148 KB Execution killed with signal 9
19 Runtime error 98 ms 262148 KB Execution killed with signal 9
20 Runtime error 101 ms 262148 KB Execution killed with signal 9
21 Runtime error 103 ms 262148 KB Execution killed with signal 9
22 Runtime error 124 ms 262152 KB Execution killed with signal 9
23 Runtime error 110 ms 262148 KB Execution killed with signal 9
24 Runtime error 108 ms 262148 KB Execution killed with signal 9
25 Runtime error 95 ms 262148 KB Execution killed with signal 9
26 Runtime error 98 ms 262148 KB Execution killed with signal 9
27 Runtime error 108 ms 262148 KB Execution killed with signal 9
28 Runtime error 103 ms 262148 KB Execution killed with signal 9
29 Runtime error 100 ms 262148 KB Execution killed with signal 9
30 Runtime error 99 ms 262148 KB Execution killed with signal 9
31 Runtime error 101 ms 262148 KB Execution killed with signal 9
32 Runtime error 94 ms 262148 KB Execution killed with signal 9
33 Runtime error 100 ms 262148 KB Execution killed with signal 9
34 Runtime error 110 ms 262148 KB Execution killed with signal 9
35 Runtime error 121 ms 262148 KB Execution killed with signal 9
36 Runtime error 94 ms 262148 KB Execution killed with signal 9
37 Runtime error 101 ms 262148 KB Execution killed with signal 9
38 Runtime error 98 ms 262148 KB Execution killed with signal 9
39 Runtime error 102 ms 262148 KB Execution killed with signal 9
40 Runtime error 97 ms 262148 KB Execution killed with signal 9
41 Runtime error 97 ms 262148 KB Execution killed with signal 9
42 Runtime error 108 ms 262148 KB Execution killed with signal 9