# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
923644 | 2024-02-07T14:11:17 Z | sleepntsheep | Brunhilda’s Birthday (BOI13_brunhilda) | C++17 | 12 ms | 5480 KB |
#include <iostream> #include <fstream> #include <iomanip> #include <cmath> #include <cassert> #include <cstring> #include <vector> #include <algorithm> #include <deque> #include <set> #include <utility> #include <array> #include <complex> using u32 = unsigned; using i32 = int; using i64 = long long; using u64 = unsigned long long; using f64 = double; using f80 = long double; using namespace std; #define ALL(x) begin(x), end(x) #define ShinLena cin.tie(nullptr)->sync_with_stdio(false); #if 0 #define M 100005 #define N 10000005 #else #define M 20000 #define N 20000 #endif int m, q, dp[N], p[M]; multiset<int> ms; basic_string<int> act[N], fus[N]; int main() { memset(dp, 63, sizeof dp); ShinLena; dp[0] = 0; cin >> m >> q; for (int i = 1; i <= m; ++i) { cin >> p[i]; if (p[i] >= N) continue; act[1].push_back(1); act[p[i]].push_back(-1); for (int j = p[i]; j < N; j += p[i]) fus[j].push_back(p[i]); } for (int i = 1; i < N; ++i) { for (auto x : act[i]) { if (x < 0) ms.erase(ms.find(-x - 1)); else ms.insert(x - 1); } if (ms.size()) dp[i] = min(dp[i], *ms.begin() + 1); for (auto x : fus[i]) { if (i + 1 < N) act[i+1].push_back(dp[i] + 1); if (i + x < N) act[x+i].push_back(-dp[i] - 1); } } for (int x, i = 1; i <= q; ++i) { cin >> x; if (dp[x] > 1e9) cout << "oo\n"; else cout << dp[x] << '\n'; } return 0; }
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1628 KB | Output is correct |
2 | Correct | 3 ms | 1628 KB | Output is correct |
3 | Correct | 2 ms | 1628 KB | Output is correct |
4 | Correct | 2 ms | 1628 KB | Output is correct |
5 | Correct | 1 ms | 1628 KB | Output is correct |
6 | Correct | 1 ms | 1628 KB | Output is correct |
7 | Correct | 1 ms | 1628 KB | Output is correct |
8 | Correct | 2 ms | 1808 KB | Output is correct |
9 | Correct | 3 ms | 1880 KB | Output is correct |
10 | Correct | 4 ms | 2140 KB | Output is correct |
11 | Correct | 3 ms | 1688 KB | Output is correct |
12 | Correct | 1 ms | 2044 KB | Output is correct |
13 | Correct | 10 ms | 2648 KB | Output is correct |
14 | Correct | 10 ms | 2652 KB | Output is correct |
15 | Correct | 3 ms | 1628 KB | Output is correct |
16 | Correct | 3 ms | 1628 KB | Output is correct |
17 | Correct | 3 ms | 1832 KB | Output is correct |
18 | Correct | 3 ms | 1628 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 3220 KB | Execution killed with signal 11 |
2 | Runtime error | 5 ms | 3420 KB | Execution killed with signal 11 |
3 | Runtime error | 5 ms | 3676 KB | Execution killed with signal 11 |
4 | Runtime error | 3 ms | 3164 KB | Execution killed with signal 11 |
5 | Runtime error | 4 ms | 3420 KB | Execution killed with signal 11 |
6 | Runtime error | 3 ms | 3352 KB | Execution killed with signal 11 |
7 | Runtime error | 3 ms | 3420 KB | Execution killed with signal 11 |
8 | Runtime error | 3 ms | 3164 KB | Execution killed with signal 11 |
9 | Runtime error | 4 ms | 3420 KB | Execution killed with signal 11 |
10 | Runtime error | 5 ms | 3672 KB | Execution killed with signal 11 |
11 | Runtime error | 12 ms | 5480 KB | Execution killed with signal 11 |
12 | Runtime error | 6 ms | 3432 KB | Execution killed with signal 11 |
13 | Runtime error | 3 ms | 3176 KB | Execution killed with signal 11 |
14 | Runtime error | 3 ms | 3176 KB | Execution killed with signal 11 |
15 | Runtime error | 5 ms | 3432 KB | Execution killed with signal 11 |
16 | Runtime error | 5 ms | 3432 KB | Execution killed with signal 11 |
17 | Runtime error | 9 ms | 5224 KB | Execution killed with signal 11 |
18 | Runtime error | 5 ms | 3432 KB | Execution killed with signal 11 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 3420 KB | Execution killed with signal 11 |
2 | Runtime error | 4 ms | 3676 KB | Execution killed with signal 11 |
3 | Runtime error | 5 ms | 3676 KB | Execution killed with signal 11 |
4 | Runtime error | 6 ms | 3676 KB | Execution killed with signal 11 |
5 | Runtime error | 4 ms | 3420 KB | Execution killed with signal 11 |
6 | Runtime error | 9 ms | 4524 KB | Execution killed with signal 11 |
7 | Runtime error | 5 ms | 3420 KB | Execution killed with signal 11 |
8 | Runtime error | 5 ms | 3416 KB | Execution killed with signal 11 |
9 | Runtime error | 5 ms | 3420 KB | Execution killed with signal 11 |
10 | Runtime error | 5 ms | 3420 KB | Execution killed with signal 11 |
11 | Runtime error | 4 ms | 3420 KB | Execution killed with signal 11 |
12 | Runtime error | 8 ms | 4444 KB | Execution killed with signal 11 |
13 | Runtime error | 10 ms | 4956 KB | Execution killed with signal 11 |
14 | Runtime error | 6 ms | 4188 KB | Execution killed with signal 11 |
15 | Runtime error | 9 ms | 4964 KB | Execution killed with signal 11 |
16 | Runtime error | 10 ms | 5468 KB | Execution killed with signal 11 |
17 | Runtime error | 5 ms | 3420 KB | Execution killed with signal 11 |
18 | Runtime error | 5 ms | 3508 KB | Execution killed with signal 11 |
19 | Runtime error | 3 ms | 3344 KB | Execution killed with signal 11 |
20 | Runtime error | 5 ms | 3676 KB | Execution killed with signal 11 |
21 | Runtime error | 7 ms | 4700 KB | Execution killed with signal 11 |
22 | Runtime error | 5 ms | 3420 KB | Execution killed with signal 11 |
23 | Runtime error | 6 ms | 3420 KB | Execution killed with signal 11 |
24 | Runtime error | 3 ms | 3164 KB | Execution killed with signal 11 |
25 | Runtime error | 6 ms | 3672 KB | Execution killed with signal 11 |
26 | Runtime error | 5 ms | 3676 KB | Execution killed with signal 11 |
27 | Runtime error | 5 ms | 3676 KB | Execution killed with signal 11 |
28 | Runtime error | 3 ms | 3164 KB | Execution killed with signal 11 |
29 | Runtime error | 4 ms | 3472 KB | Execution killed with signal 11 |
30 | Runtime error | 5 ms | 3420 KB | Execution killed with signal 11 |
31 | Runtime error | 3 ms | 3164 KB | Execution killed with signal 11 |
32 | Runtime error | 4 ms | 3204 KB | Execution killed with signal 11 |
33 | Runtime error | 2 ms | 3164 KB | Execution killed with signal 11 |
34 | Runtime error | 5 ms | 3420 KB | Execution killed with signal 11 |
35 | Runtime error | 3 ms | 3164 KB | Execution killed with signal 11 |
36 | Runtime error | 5 ms | 3420 KB | Execution killed with signal 11 |
37 | Runtime error | 5 ms | 3420 KB | Execution killed with signal 11 |
38 | Runtime error | 8 ms | 4444 KB | Execution killed with signal 11 |
39 | Runtime error | 3 ms | 3164 KB | Execution killed with signal 11 |
40 | Runtime error | 9 ms | 3932 KB | Execution killed with signal 11 |
41 | Runtime error | 4 ms | 3420 KB | Execution killed with signal 11 |
42 | Runtime error | 10 ms | 5356 KB | Execution killed with signal 11 |