# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
256254 | 2020-08-02T12:26:16 Z | Saboon | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 745 ms | 262148 KB |
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); typedef long long ll; const int maxn = 1e7 + 10; int cnt[maxn]; int last[maxn], pre[6*maxn], p[6*maxn]; int Q[6*maxn], tail, head; int dp[maxn]; int main(){ ios_base::sync_with_stdio(false); int m, q; cin >> m >> q; int sz = 0; memset(last, -1, sizeof last); for (int i = 0; i < m; i++){ int x; cin >> x; p[sz] = x, pre[sz] = last[0], last[0] = sz ++; } int n = 1000*1000*10; int mxm = n+1; for (int i = 0; i <= n; i++){ while (last[i] != -1){ int idx = last[i]; if (i > 0) cnt[i-p[idx]] ++; Q[head++] = i; p[sz] = p[idx], pre[sz] = last[i+p[idx]], last[i+p[idx]] = sz ++; last[i] = pre[last[i]]; } while (tail < head and cnt[Q[tail]] > 0) cnt[Q[tail++]] --; if (i > 0){ if (Q[tail] == i){ dp[i] = -1; mxm = i; break; } dp[i] = dp[Q[tail]] + 1; } } while (q --){ int x; cin >> x; if (x >= mxm) cout << "oo\n"; else cout << dp[x] << '\n'; } }
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 29 ms | 39544 KB | Output is correct |
2 | Correct | 291 ms | 238628 KB | Output is correct |
3 | Correct | 28 ms | 44032 KB | Output is correct |
4 | Correct | 144 ms | 126840 KB | Output is correct |
5 | Correct | 174 ms | 152824 KB | Output is correct |
6 | Correct | 26 ms | 39544 KB | Output is correct |
7 | Correct | 35 ms | 44024 KB | Output is correct |
8 | Correct | 53 ms | 58360 KB | Output is correct |
9 | Runtime error | 372 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
10 | Runtime error | 383 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
11 | Correct | 337 ms | 245880 KB | Output is correct |
12 | Correct | 116 ms | 124152 KB | Output is correct |
13 | Runtime error | 435 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
14 | Runtime error | 434 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
15 | Correct | 309 ms | 235256 KB | Output is correct |
16 | Correct | 293 ms | 238840 KB | Output is correct |
17 | Correct | 181 ms | 153336 KB | Output is correct |
18 | Correct | 160 ms | 126968 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 178 ms | 138616 KB | Output is correct |
2 | Correct | 223 ms | 148344 KB | Output is correct |
3 | Runtime error | 647 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
4 | Correct | 237 ms | 175608 KB | Output is correct |
5 | Runtime error | 580 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
6 | Correct | 280 ms | 202104 KB | Output is correct |
7 | Correct | 189 ms | 138616 KB | Output is correct |
8 | Correct | 215 ms | 169208 KB | Output is correct |
9 | Runtime error | 652 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
10 | Runtime error | 638 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
11 | Runtime error | 603 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
12 | Runtime error | 410 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
13 | Correct | 165 ms | 149112 KB | Output is correct |
14 | Correct | 247 ms | 175736 KB | Output is correct |
15 | Runtime error | 570 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
16 | Correct | 268 ms | 148344 KB | Output is correct |
17 | Runtime error | 442 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
18 | Runtime error | 626 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 604 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Runtime error | 646 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
3 | Runtime error | 630 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
4 | Runtime error | 421 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
5 | Correct | 543 ms | 149184 KB | Output is correct |
6 | Runtime error | 500 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
7 | Correct | 691 ms | 237792 KB | Output is correct |
8 | Runtime error | 624 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
9 | Runtime error | 581 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
10 | Correct | 468 ms | 253944 KB | Output is correct |
11 | Correct | 424 ms | 218316 KB | Output is correct |
12 | Runtime error | 451 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
13 | Runtime error | 558 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
14 | Runtime error | 387 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
15 | Runtime error | 454 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
16 | Runtime error | 491 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
17 | Runtime error | 604 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
18 | Runtime error | 705 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
19 | Correct | 261 ms | 173048 KB | Output is correct |
20 | Runtime error | 657 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
21 | Runtime error | 405 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
22 | Runtime error | 704 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
23 | Correct | 460 ms | 152312 KB | Output is correct |
24 | Correct | 370 ms | 141944 KB | Output is correct |
25 | Runtime error | 450 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
26 | Runtime error | 445 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
27 | Runtime error | 717 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
28 | Correct | 408 ms | 166756 KB | Output is correct |
29 | Runtime error | 745 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
30 | Runtime error | 733 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
31 | Correct | 428 ms | 172536 KB | Output is correct |
32 | Correct | 469 ms | 190456 KB | Output is correct |
33 | Correct | 351 ms | 131960 KB | Output is correct |
34 | Correct | 729 ms | 238020 KB | Output is correct |
35 | Correct | 410 ms | 169720 KB | Output is correct |
36 | Runtime error | 634 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
37 | Correct | 474 ms | 149368 KB | Output is correct |
38 | Runtime error | 472 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
39 | Correct | 401 ms | 148984 KB | Output is correct |
40 | Runtime error | 469 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
41 | Runtime error | 619 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
42 | Runtime error | 446 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |