# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
66175 | 2018-08-10T01:11:34 Z | MatheusLealV | Brunhilda’s Birthday (BOI13_brunhilda) | C++17 | 134 ms | 98784 KB |
#include <bits/stdc++.h> #define N 100050 using namespace std; int n, q, p[N], dp[10000005], prox[10000005]; int solve(int x) { if(!x) return 0; if(dp[x] != -1) return dp[x]; int ans = -2000000000, opt = 0; for(int i = n; i >= max(0, n - 100); i++) { if(x % p[i] == 0) continue; if(x % p[i] > ans) { ans = x % p[i]; opt = i; } } return dp[x] = opt ? solve(x - ans) + 1: 2000000000; } int main() { ios::sync_with_stdio(false); cin.tie(0); cin>>n>>q; for(int i = 1; i <= n; i++) cin>>p[i]; sort(p + 1, p + n + 1); memset(dp, -1, sizeof dp); for(int i = 1, x; i <= q; i++) { cin>>x; int s = solve(x); if(s >= 2000000000) cout<<"oo\n"; else cout<<s<<"\n"; //print(x); } }
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 84 ms | 78712 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
2 | Runtime error | 85 ms | 78916 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
3 | Runtime error | 82 ms | 79088 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
4 | Runtime error | 90 ms | 79228 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
5 | Runtime error | 77 ms | 79228 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
6 | Runtime error | 88 ms | 79228 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
7 | Runtime error | 90 ms | 79312 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
8 | Runtime error | 77 ms | 79312 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
9 | Runtime error | 90 ms | 79312 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
10 | Runtime error | 79 ms | 79312 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
11 | Runtime error | 81 ms | 79460 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
12 | Runtime error | 77 ms | 79460 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
13 | Runtime error | 78 ms | 79460 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
14 | Runtime error | 77 ms | 79460 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
15 | Runtime error | 81 ms | 79460 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
16 | Runtime error | 92 ms | 79460 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
17 | Runtime error | 84 ms | 79460 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
18 | Runtime error | 85 ms | 79460 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 82 ms | 79460 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
2 | Runtime error | 99 ms | 79992 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
3 | Runtime error | 90 ms | 79992 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
4 | Runtime error | 79 ms | 79992 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
5 | Runtime error | 88 ms | 80060 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
6 | Runtime error | 85 ms | 80060 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
7 | Runtime error | 82 ms | 80060 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
8 | Runtime error | 83 ms | 80060 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
9 | Runtime error | 91 ms | 80788 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
10 | Runtime error | 98 ms | 81288 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
11 | Runtime error | 87 ms | 81424 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
12 | Runtime error | 82 ms | 81424 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
13 | Runtime error | 92 ms | 81424 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
14 | Runtime error | 87 ms | 81424 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
15 | Runtime error | 84 ms | 81680 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
16 | Runtime error | 95 ms | 82664 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
17 | Runtime error | 79 ms | 82664 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
18 | Runtime error | 93 ms | 83600 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 89 ms | 83836 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
2 | Runtime error | 89 ms | 84140 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
3 | Runtime error | 87 ms | 84732 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
4 | Runtime error | 78 ms | 84732 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
5 | Runtime error | 90 ms | 85992 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
6 | Runtime error | 81 ms | 85992 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
7 | Runtime error | 95 ms | 87296 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
8 | Runtime error | 92 ms | 87436 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
9 | Runtime error | 103 ms | 87688 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
10 | Runtime error | 81 ms | 87756 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
11 | Runtime error | 84 ms | 87756 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
12 | Runtime error | 81 ms | 87800 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
13 | Runtime error | 83 ms | 88184 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
14 | Runtime error | 79 ms | 88192 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
15 | Runtime error | 82 ms | 88192 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
16 | Runtime error | 81 ms | 88420 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
17 | Runtime error | 86 ms | 89000 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
18 | Runtime error | 99 ms | 89580 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
19 | Runtime error | 91 ms | 89580 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
20 | Runtime error | 134 ms | 90288 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
21 | Runtime error | 96 ms | 90288 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
22 | Runtime error | 109 ms | 91492 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
23 | Runtime error | 84 ms | 91636 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
24 | Runtime error | 87 ms | 91636 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
25 | Runtime error | 83 ms | 91636 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
26 | Runtime error | 83 ms | 91636 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
27 | Runtime error | 96 ms | 92976 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
28 | Runtime error | 88 ms | 92976 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
29 | Runtime error | 114 ms | 93824 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
30 | Runtime error | 86 ms | 94344 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
31 | Runtime error | 88 ms | 94344 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
32 | Runtime error | 82 ms | 94344 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
33 | Runtime error | 92 ms | 94344 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
34 | Runtime error | 99 ms | 95524 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
35 | Runtime error | 82 ms | 95524 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
36 | Runtime error | 94 ms | 96540 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
37 | Runtime error | 91 ms | 97532 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
38 | Runtime error | 80 ms | 97532 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
39 | Runtime error | 83 ms | 97532 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
40 | Runtime error | 84 ms | 97532 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
41 | Runtime error | 98 ms | 98784 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
42 | Runtime error | 88 ms | 98784 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |