# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
331141 | 2020-11-27T14:08:18 Z | Sho10 | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 745 ms | 262148 KB |
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10 #define ll long long #define double long double #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #define all(a) (a).begin(), (a).end() #define f first #define s second #define pb push_back #define mp make_pair #define pi pair #define rc(s) return cout<<s,0 #define endl '\n' #define mod 1000007 #define PI 3.14159265359 #define MAXN 100005 #define INF 1000000005 #define LINF 1000000000000000005ll #define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; ll n,m,ans[20000005],a[20000005]; int32_t main(){ CODE_START n=2e7; cin>>m; ll q; cin>>q; for(ll i=1;i<=m;i++) { ll x; cin>>x; for(ll j=x;j<=n;j+=x){ a[j-1]=max(a[j-1],x-1); } } for(ll i=n;i>=1;i--) { a[i]=max(a[i],a[i+1]-1); } for(ll i=1;i<=n;i++) { if(a[i]&&(ans[i-a[i]]||i-a[i]==0)){ ans[i]=ans[i-a[i]]+1; } } while(q--){ ll x; cin>>x; if(ans[x]){ cout<<ans[x]<<endl; }else cout<<"oo"<<endl; } }
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 209 ms | 157292 KB | Output is correct |
2 | Runtime error | 283 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
3 | Correct | 247 ms | 159340 KB | Output is correct |
4 | Runtime error | 222 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
5 | Runtime error | 247 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
6 | Correct | 213 ms | 157420 KB | Output is correct |
7 | Correct | 238 ms | 159340 KB | Output is correct |
8 | Correct | 260 ms | 164332 KB | Output is correct |
9 | Runtime error | 314 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
10 | Runtime error | 353 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
11 | Runtime error | 330 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
12 | Runtime error | 223 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
13 | Runtime error | 581 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
14 | Runtime error | 554 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
15 | Runtime error | 299 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
16 | Runtime error | 277 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
17 | Runtime error | 269 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
18 | Runtime error | 215 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 257 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Runtime error | 272 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
3 | Runtime error | 684 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
4 | Runtime error | 311 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
5 | Runtime error | 473 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
6 | Runtime error | 270 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
7 | Runtime error | 251 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
8 | Runtime error | 290 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
9 | Runtime error | 550 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
10 | Runtime error | 670 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
11 | Runtime error | 654 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
12 | Runtime error | 394 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
13 | Runtime error | 240 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
14 | Runtime error | 301 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
15 | Runtime error | 569 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
16 | Runtime error | 274 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
17 | Runtime error | 568 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
18 | Runtime error | 570 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 578 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Runtime error | 700 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
3 | Runtime error | 695 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
4 | Runtime error | 402 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
5 | Runtime error | 312 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
6 | Runtime error | 538 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
7 | Runtime error | 480 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
8 | Runtime error | 569 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
9 | Runtime error | 564 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
10 | Runtime error | 452 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
11 | Runtime error | 381 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
12 | Runtime error | 542 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
13 | Runtime error | 656 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
14 | Runtime error | 393 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
15 | Runtime error | 543 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
16 | Runtime error | 612 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
17 | Runtime error | 531 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
18 | Runtime error | 681 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
19 | Runtime error | 242 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
20 | Runtime error | 682 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
21 | Runtime error | 444 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
22 | Runtime error | 668 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
23 | Runtime error | 293 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
24 | Runtime error | 237 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
25 | Runtime error | 429 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
26 | Runtime error | 396 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
27 | Runtime error | 745 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
28 | Runtime error | 249 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
29 | Runtime error | 606 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
30 | Runtime error | 546 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
31 | Runtime error | 280 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
32 | Runtime error | 316 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
33 | Runtime error | 210 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
34 | Runtime error | 476 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
35 | Runtime error | 269 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
36 | Runtime error | 662 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
37 | Runtime error | 292 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
38 | Runtime error | 536 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
39 | Runtime error | 254 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
40 | Runtime error | 454 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
41 | Runtime error | 426 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
42 | Runtime error | 606 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |