# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
152506 | 2019-09-08T08:46:56 Z | dolphingarlic | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 1000 ms | 262148 KB |
#include <bits/stdc++.h> #pragma GCC Optimize("O3") #define FOR(i, x, y) for (int i = x; i < y; i++) #define MAXN 20000001 typedef long long ll; using namespace std; ll dp[MAXN], p[100001], max_divide[MAXN], to[MAXN]; int main() { iostream::sync_with_stdio(false); cin.tie(0); int n, q; cin >> n >> q; FOR(i, 0, n) cin >> p[i]; FOR(i, 0, n) for (int j = p[i]; j < MAXN; j += p[i]) max_divide[j] = p[i]; ll mn = INT_MAX; for (int i = MAXN - 1; i > 0; i--) { mn = min(mn, i + 1 - max_divide[i + 1]); to[i] = mn; } FOR(i, 1, MAXN) if (to[i] == i) dp[i] = INT_MAX; else dp[i] = dp[to[i]] + 1; FOR(i, 0, q) { int x; cin >> x; if (dp[x] >= INT_MAX) cout << "oo\n"; else cout << dp[x] << '\n'; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 245 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Runtime error | 309 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
3 | Runtime error | 295 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
4 | Runtime error | 243 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
5 | Runtime error | 278 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
6 | Runtime error | 260 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
7 | Runtime error | 292 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
8 | Runtime error | 308 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
9 | Runtime error | 372 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
10 | Runtime error | 437 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
11 | Runtime error | 435 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
12 | Runtime error | 278 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
13 | Runtime error | 791 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
14 | Runtime error | 719 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
15 | Runtime error | 336 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
16 | Runtime error | 308 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
17 | Runtime error | 303 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
18 | Runtime error | 241 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 292 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Runtime error | 314 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
3 | Runtime error | 895 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
4 | Runtime error | 355 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
5 | Runtime error | 591 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
6 | Runtime error | 342 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
7 | Runtime error | 293 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
8 | Runtime error | 357 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
9 | Runtime error | 695 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
10 | Runtime error | 912 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
11 | Runtime error | 849 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
12 | Runtime error | 473 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
13 | Runtime error | 261 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
14 | Runtime error | 352 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
15 | Runtime error | 735 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
16 | Runtime error | 314 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
17 | Runtime error | 785 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
18 | Runtime error | 695 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 727 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Runtime error | 904 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
3 | Runtime error | 898 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
4 | Runtime error | 494 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
5 | Runtime error | 332 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
6 | Runtime error | 683 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
7 | Runtime error | 591 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
8 | Runtime error | 733 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
9 | Runtime error | 782 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
10 | Runtime error | 562 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
11 | Runtime error | 477 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
12 | Runtime error | 658 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
13 | Runtime error | 829 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
14 | Runtime error | 454 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
15 | Runtime error | 711 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
16 | Runtime error | 785 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
17 | Runtime error | 672 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
18 | Runtime error | 887 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
19 | Runtime error | 270 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
20 | Runtime error | 912 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
21 | Runtime error | 555 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
22 | Runtime error | 856 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
23 | Runtime error | 344 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
24 | Runtime error | 270 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
25 | Runtime error | 551 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
26 | Runtime error | 504 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
27 | Runtime error | 1036 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
28 | Runtime error | 287 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
29 | Runtime error | 789 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
30 | Runtime error | 692 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
31 | Runtime error | 333 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
32 | Runtime error | 367 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
33 | Runtime error | 235 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
34 | Runtime error | 589 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
35 | Runtime error | 311 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
36 | Runtime error | 826 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
37 | Runtime error | 348 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
38 | Runtime error | 743 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
39 | Runtime error | 332 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
40 | Runtime error | 572 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
41 | Runtime error | 521 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
42 | Runtime error | 780 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |