# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31279 | 2017-08-17T20:44:47 Z | imaxblue | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 0 ms | 1844 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define mp make_pair #define pb push_back #define x first #define y second #define pii pair<int, int> #define p3i pair<pii, int> #define pll pair<ll, ll> #define p3l pair<pll, ll> #define lseg L, (L+R)/2, N*2+1 #define rseg (L+R)/2+1, R, N*2+2 #define ub upper_bound #define lb lower_bound #define pq priority_queue #define MN 1000000007 #define fox(k, x) for (int k=0; k<x; ++k) #define fox1(k, x) for (int k=1; k<=x; ++k) #define foxr(k, x) for (int k=x-1; k>=0; --k) #define foxr1(k, x) for (int k=x; k>0; --k) #define ms multiset #define flood(x) memset(x, 0x3f3f3f3f, sizeof x) #define drain(x) memset(x, 0, sizeof x) int n, q, x, c, lo=(1 << 30), pre[10000005], dp[10000005]; vector<int> f[10000005]; bool p[10000005], u[10000005]; int main(){ cin.tie(0); cin.sync_with_stdio(0); cout.tie(0); cout.sync_with_stdio(0); cin >> n >> q; fox(l, n){ cin >> x; p[x]=1; lo=min(lo, 10000000/x*x); } for(int l=2; l<=10000000; ++l){ if (u[l]) continue; for (int l2=l; l2<=10000000; l2+=l){ if (p[l]) f[l2].pb(l); u[l2]=1; } } foxr1(l, 10000000){ pre[l]=lo; fox(l2, f[l].size()){ lo=min(lo, l-f[l][l2]); } } fox1(l, 10000000){ if (pre[l]==l) dp[l]=(1 << 30); dp[l]=dp[pre[l]]+1; } fox(l, q){ cin >> x; if (dp[x]>=(1 << 30)){ cout << "oo\n"; } else { cout << dp[x] << endl; } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
4 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
6 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
7 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
8 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
9 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
11 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
12 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
13 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
14 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
15 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
16 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
17 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
18 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
4 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
6 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
7 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
8 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
9 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
11 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
12 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
13 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
14 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
15 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
16 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
17 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
18 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
4 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
6 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
7 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
8 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
9 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
11 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
12 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
13 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
14 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
15 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
16 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
17 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
18 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
19 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
20 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
21 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
22 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
23 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
24 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
25 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
26 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
27 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
28 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
29 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
30 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
31 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
32 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
33 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
34 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
35 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
36 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
37 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
38 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
39 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
40 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
41 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
42 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |