# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
742489 | 2023-05-16T10:15:59 Z | irmuun | Brunhilda’s Birthday (BOI13_brunhilda) | C++17 | 12 ms | 1260 KB |
#include<bits/stdc++.h> using namespace std; #define pb push_back #define ll long long #define ff first #define ss second #define all(s) s.begin(),s.end() const int MAX=1e9; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int m,q; cin>>m>>q; int p[m+5]; for(int i=1;i<=m;i++){ cin>>p[i]; } sort(p+1,p+m+1); if(q==1){ int n; cin>>n; int ans=0; while(n>0){ int nxt=n; for(int i=1;i<=m;i++){ nxt=min(nxt,n/p[i]*p[i]); } if(nxt==n){ cout<<"oo"; return 0; } ans++; n=nxt; } cout<<ans; return 0; } int ans[10005]; ans[0]=0; for(int i=1;i<p[m];i++){ ans[i]=1; } for(int i=p[m];i<=10000;i++){ ans[i]=MAX; for(int j=1;j<=m;j++){ ans[i]=min(ans[i],ans[i/p[j]*p[j]]+1); } } while(q--){ int n; cin>>n; if(ans[n]==MAX){ cout<<"oo\n"; } else{ cout<<ans[n]<<"\n"; } } }
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 2 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 3 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 2 ms | 340 KB | Output is correct |
11 | Correct | 2 ms | 340 KB | Output is correct |
12 | Correct | 4 ms | 356 KB | Output is correct |
13 | Correct | 5 ms | 340 KB | Output is correct |
14 | Correct | 6 ms | 356 KB | Output is correct |
15 | Correct | 2 ms | 340 KB | Output is correct |
16 | Correct | 3 ms | 340 KB | Output is correct |
17 | Correct | 4 ms | 340 KB | Output is correct |
18 | Correct | 4 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 340 KB | Output is correct |
2 | Correct | 10 ms | 712 KB | Output is correct |
3 | Correct | 8 ms | 632 KB | Output is correct |
4 | Correct | 3 ms | 340 KB | Output is correct |
5 | Correct | 8 ms | 468 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 3 ms | 340 KB | Output is correct |
8 | Correct | 2 ms | 340 KB | Output is correct |
9 | Correct | 11 ms | 632 KB | Output is correct |
10 | Correct | 8 ms | 596 KB | Output is correct |
11 | Correct | 8 ms | 468 KB | Output is correct |
12 | Correct | 3 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 2 ms | 364 KB | Output is correct |
15 | Correct | 5 ms | 468 KB | Output is correct |
16 | Correct | 10 ms | 712 KB | Output is correct |
17 | Correct | 6 ms | 340 KB | Output is correct |
18 | Correct | 12 ms | 744 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 852 KB | Execution killed with signal 11 |
2 | Runtime error | 5 ms | 940 KB | Execution killed with signal 11 |
3 | Runtime error | 6 ms | 936 KB | Execution killed with signal 11 |
4 | Runtime error | 2 ms | 468 KB | Execution killed with signal 11 |
5 | Runtime error | 10 ms | 1236 KB | Execution killed with signal 11 |
6 | Runtime error | 1 ms | 596 KB | Execution killed with signal 11 |
7 | Runtime error | 10 ms | 1256 KB | Execution killed with signal 11 |
8 | Runtime error | 6 ms | 852 KB | Execution killed with signal 11 |
9 | Runtime error | 6 ms | 952 KB | Execution killed with signal 11 |
10 | Runtime error | 2 ms | 468 KB | Execution killed with signal 11 |
11 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
12 | Runtime error | 2 ms | 468 KB | Execution killed with signal 11 |
13 | Runtime error | 4 ms | 728 KB | Execution killed with signal 11 |
14 | Runtime error | 3 ms | 468 KB | Execution killed with signal 11 |
15 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
16 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
17 | Runtime error | 5 ms | 852 KB | Execution killed with signal 11 |
18 | Runtime error | 8 ms | 852 KB | Execution killed with signal 11 |
19 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
20 | Runtime error | 5 ms | 852 KB | Execution killed with signal 11 |
21 | Runtime error | 5 ms | 488 KB | Execution killed with signal 11 |
22 | Runtime error | 9 ms | 1236 KB | Execution killed with signal 11 |
23 | Runtime error | 3 ms | 744 KB | Execution killed with signal 11 |
24 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
25 | Runtime error | 1 ms | 548 KB | Execution killed with signal 11 |
26 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
27 | Runtime error | 10 ms | 1260 KB | Execution killed with signal 11 |
28 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
29 | Runtime error | 9 ms | 1236 KB | Execution killed with signal 11 |
30 | Runtime error | 7 ms | 980 KB | Execution killed with signal 11 |
31 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
32 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
33 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
34 | Runtime error | 10 ms | 1260 KB | Execution killed with signal 11 |
35 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
36 | Runtime error | 9 ms | 1220 KB | Execution killed with signal 11 |
37 | Runtime error | 10 ms | 1252 KB | Execution killed with signal 11 |
38 | Runtime error | 2 ms | 596 KB | Execution killed with signal 11 |
39 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
40 | Runtime error | 2 ms | 596 KB | Execution killed with signal 11 |
41 | Runtime error | 10 ms | 1236 KB | Execution killed with signal 11 |
42 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |