# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
869002 | 2023-11-02T22:36:51 Z | bobbilyking | Brunhilda’s Birthday (BOI13_brunhilda) | C++17 | 160 ms | 262144 KB |
#pragma GCC target ("avx2") #pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #include<bits/stdc++.h> #include<math.h> using namespace std; typedef int ll; typedef long double ld; typedef pair<ll, ll> pl; #define K first #define V second #define G(x) ll x; cin >> x; #define GD(x) ld x; cin >> x; #define GS(s) string s; cin >> s; #define EX(x) { cout << x << '\n'; exit(0); } #define A(a) (a).begin(), (a).end() #define F(i, l, r) for (ll i = (l); i < r; ++i) #define NN 10000010 #define M 1000000007 // 998244353 ll dp[NN]; ll last_p_dp[NN]; // last multiple of P's dp value vector<ll> upd[NN]; // this prime gets a new dp value at this step int main(){ // freopen("a.in", "r", stdin); // freopen("a.out", "w", stdout); ios_base::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20); G(n) G(q) map<ll, ll> v; // might tle; replace with map? F(i, 0, n) { G(p) upd[p].push_back(p); v[0]++; } dp[0] = 0; F(i, 1, NN) { for (auto x: upd[i]) { if (i + x < NN) upd[i+x].push_back(x); if (!--v[last_p_dp[x]]) v.erase(last_p_dp[x]); } dp[i] = (v.size() ? v.begin()->K : NN) + 1; for (auto x: upd[i]) { last_p_dp[x] = dp[i]; v[dp[i]]++; } upd[i].clear(); } while (q--){ G(n) if (dp[n] >= NN) cout << "oo\n"; else cout << dp[n] << '\n'; } }
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 84 ms | 262144 KB | Execution killed with signal 9 |
2 | Runtime error | 84 ms | 262144 KB | Execution killed with signal 9 |
3 | Runtime error | 80 ms | 262144 KB | Execution killed with signal 9 |
4 | Runtime error | 99 ms | 262144 KB | Execution killed with signal 9 |
5 | Runtime error | 90 ms | 262144 KB | Execution killed with signal 9 |
6 | Runtime error | 93 ms | 262144 KB | Execution killed with signal 9 |
7 | Runtime error | 78 ms | 262144 KB | Execution killed with signal 9 |
8 | Runtime error | 98 ms | 262144 KB | Execution killed with signal 9 |
9 | Runtime error | 96 ms | 262144 KB | Execution killed with signal 9 |
10 | Runtime error | 100 ms | 262144 KB | Execution killed with signal 9 |
11 | Runtime error | 91 ms | 262144 KB | Execution killed with signal 9 |
12 | Runtime error | 90 ms | 262144 KB | Execution killed with signal 9 |
13 | Runtime error | 143 ms | 262144 KB | Execution killed with signal 9 |
14 | Runtime error | 119 ms | 262144 KB | Execution killed with signal 9 |
15 | Runtime error | 86 ms | 262144 KB | Execution killed with signal 9 |
16 | Runtime error | 93 ms | 262144 KB | Execution killed with signal 9 |
17 | Runtime error | 94 ms | 262144 KB | Execution killed with signal 9 |
18 | Runtime error | 101 ms | 262144 KB | Execution killed with signal 9 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 115 ms | 262144 KB | Execution killed with signal 9 |
2 | Runtime error | 108 ms | 262144 KB | Execution killed with signal 9 |
3 | Runtime error | 133 ms | 262144 KB | Execution killed with signal 9 |
4 | Runtime error | 103 ms | 262144 KB | Execution killed with signal 9 |
5 | Runtime error | 110 ms | 262144 KB | Execution killed with signal 9 |
6 | Runtime error | 87 ms | 262144 KB | Execution killed with signal 9 |
7 | Runtime error | 119 ms | 262144 KB | Execution killed with signal 9 |
8 | Runtime error | 101 ms | 262144 KB | Execution killed with signal 9 |
9 | Runtime error | 114 ms | 262144 KB | Execution killed with signal 9 |
10 | Runtime error | 143 ms | 262144 KB | Execution killed with signal 9 |
11 | Runtime error | 137 ms | 262144 KB | Execution killed with signal 9 |
12 | Runtime error | 109 ms | 262144 KB | Execution killed with signal 9 |
13 | Runtime error | 87 ms | 262144 KB | Execution killed with signal 9 |
14 | Runtime error | 115 ms | 262144 KB | Execution killed with signal 9 |
15 | Runtime error | 142 ms | 262144 KB | Execution killed with signal 9 |
16 | Runtime error | 109 ms | 262144 KB | Execution killed with signal 9 |
17 | Runtime error | 119 ms | 262144 KB | Execution killed with signal 9 |
18 | Runtime error | 122 ms | 262144 KB | Execution killed with signal 9 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 140 ms | 262144 KB | Execution killed with signal 9 |
2 | Runtime error | 130 ms | 262144 KB | Execution killed with signal 9 |
3 | Runtime error | 130 ms | 262144 KB | Execution killed with signal 9 |
4 | Runtime error | 103 ms | 262144 KB | Execution killed with signal 9 |
5 | Runtime error | 116 ms | 262144 KB | Execution killed with signal 9 |
6 | Runtime error | 115 ms | 262144 KB | Execution killed with signal 9 |
7 | Runtime error | 119 ms | 262144 KB | Execution killed with signal 9 |
8 | Runtime error | 125 ms | 262144 KB | Execution killed with signal 9 |
9 | Runtime error | 151 ms | 262144 KB | Execution killed with signal 9 |
10 | Runtime error | 123 ms | 262144 KB | Execution killed with signal 9 |
11 | Runtime error | 104 ms | 262144 KB | Execution killed with signal 9 |
12 | Runtime error | 117 ms | 262144 KB | Execution killed with signal 9 |
13 | Runtime error | 129 ms | 262144 KB | Execution killed with signal 9 |
14 | Runtime error | 113 ms | 262144 KB | Execution killed with signal 9 |
15 | Runtime error | 124 ms | 262144 KB | Execution killed with signal 9 |
16 | Runtime error | 132 ms | 262144 KB | Execution killed with signal 9 |
17 | Runtime error | 131 ms | 262144 KB | Execution killed with signal 9 |
18 | Runtime error | 126 ms | 262144 KB | Execution killed with signal 9 |
19 | Runtime error | 92 ms | 262144 KB | Execution killed with signal 9 |
20 | Runtime error | 140 ms | 262144 KB | Execution killed with signal 9 |
21 | Runtime error | 111 ms | 262144 KB | Execution killed with signal 9 |
22 | Runtime error | 140 ms | 262144 KB | Execution killed with signal 9 |
23 | Runtime error | 123 ms | 262144 KB | Execution killed with signal 9 |
24 | Runtime error | 118 ms | 262144 KB | Execution killed with signal 9 |
25 | Runtime error | 106 ms | 262144 KB | Execution killed with signal 9 |
26 | Runtime error | 108 ms | 262144 KB | Execution killed with signal 9 |
27 | Runtime error | 160 ms | 262144 KB | Execution killed with signal 9 |
28 | Runtime error | 93 ms | 262144 KB | Execution killed with signal 9 |
29 | Runtime error | 113 ms | 262144 KB | Execution killed with signal 9 |
30 | Runtime error | 110 ms | 262144 KB | Execution killed with signal 9 |
31 | Runtime error | 95 ms | 262144 KB | Execution killed with signal 9 |
32 | Runtime error | 101 ms | 262144 KB | Execution killed with signal 9 |
33 | Runtime error | 107 ms | 262144 KB | Execution killed with signal 9 |
34 | Runtime error | 117 ms | 262144 KB | Execution killed with signal 9 |
35 | Runtime error | 93 ms | 262144 KB | Execution killed with signal 9 |
36 | Runtime error | 143 ms | 262144 KB | Execution killed with signal 9 |
37 | Runtime error | 124 ms | 262144 KB | Execution killed with signal 9 |
38 | Runtime error | 117 ms | 262144 KB | Execution killed with signal 9 |
39 | Runtime error | 101 ms | 262144 KB | Execution killed with signal 9 |
40 | Runtime error | 113 ms | 262144 KB | Execution killed with signal 9 |
41 | Runtime error | 125 ms | 262144 KB | Execution killed with signal 9 |
42 | Runtime error | 121 ms | 262144 KB | Execution killed with signal 9 |