Submission #493702

# Submission time Handle Problem Language Result Execution time Memory
493702 2021-12-12T16:07:47 Z _Monkey_ Brunhilda’s Birthday (BOI13_brunhilda) C++17
49.2063 / 100
1000 ms 262148 KB
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define el '\n'
#define ld long double
const int maxn=1e7+1,nn=1e5+1;
 
int f[maxn],oo,a[nn],n,m,q,p;
int take(int z){
    if(f[z]>=0) return f[z];
  	int maxx=z%a[0];
    for(int i=1;i<m;++i) maxx=max(maxx,z%a[i]);
  	f[z]=min(oo,take(z-maxx)+1);
    return f[z];
}
int main(){
    //freopen("T.INP","r",stdin);
    //freopen("T.OUT","w",stdout);
    ios_base::sync_with_stdio(0);cin.tie(0);
    memset(f,-1,sizeof f);
    oo=1e9;
    f[0]=0;
    cin >> m >> q;
    for(int i=0;i<m;++i) cin >> a[i];
    while(q--){
        cin >> n;
        p=take(n);
        if(p>=oo) cout << 'o' << 'o' << el;
        else cout << p << el;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 228 ms 262148 KB Execution killed with signal 9
2 Correct 16 ms 39372 KB Output is correct
3 Correct 15 ms 39420 KB Output is correct
4 Correct 20 ms 39452 KB Output is correct
5 Correct 15 ms 39388 KB Output is correct
6 Runtime error 227 ms 262148 KB Execution killed with signal 9
7 Correct 15 ms 39372 KB Output is correct
8 Correct 15 ms 39440 KB Output is correct
9 Correct 17 ms 39404 KB Output is correct
10 Correct 16 ms 39452 KB Output is correct
11 Correct 16 ms 39332 KB Output is correct
12 Correct 16 ms 39372 KB Output is correct
13 Correct 21 ms 39452 KB Output is correct
14 Correct 61 ms 39460 KB Output is correct
15 Correct 16 ms 39372 KB Output is correct
16 Correct 16 ms 39372 KB Output is correct
17 Correct 19 ms 39484 KB Output is correct
18 Correct 20 ms 39412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 39468 KB Output is correct
2 Correct 22 ms 39756 KB Output is correct
3 Correct 22 ms 39628 KB Output is correct
4 Correct 17 ms 39372 KB Output is correct
5 Correct 26 ms 39628 KB Output is correct
6 Correct 16 ms 39372 KB Output is correct
7 Correct 17 ms 39484 KB Output is correct
8 Correct 16 ms 39372 KB Output is correct
9 Correct 21 ms 39624 KB Output is correct
10 Correct 22 ms 39684 KB Output is correct
11 Correct 22 ms 39536 KB Output is correct
12 Correct 18 ms 39420 KB Output is correct
13 Correct 18 ms 39468 KB Output is correct
14 Correct 17 ms 39356 KB Output is correct
15 Correct 19 ms 39496 KB Output is correct
16 Correct 24 ms 39744 KB Output is correct
17 Correct 21 ms 39468 KB Output is correct
18 Correct 25 ms 39748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 39756 KB Time limit exceeded
2 Execution timed out 1100 ms 39544 KB Time limit exceeded
3 Execution timed out 1095 ms 39748 KB Time limit exceeded
4 Execution timed out 1089 ms 39596 KB Time limit exceeded
5 Execution timed out 1065 ms 39756 KB Time limit exceeded
6 Execution timed out 1095 ms 39472 KB Time limit exceeded
7 Execution timed out 1082 ms 39824 KB Time limit exceeded
8 Execution timed out 1091 ms 39628 KB Time limit exceeded
9 Execution timed out 1086 ms 39628 KB Time limit exceeded
10 Correct 984 ms 39608 KB Output is correct
11 Correct 961 ms 39724 KB Output is correct
12 Execution timed out 1100 ms 39620 KB Time limit exceeded
13 Execution timed out 1092 ms 39684 KB Time limit exceeded
14 Correct 66 ms 41580 KB Output is correct
15 Execution timed out 1097 ms 39616 KB Time limit exceeded
16 Execution timed out 1067 ms 39588 KB Time limit exceeded
17 Execution timed out 1093 ms 39628 KB Time limit exceeded
18 Execution timed out 1096 ms 39628 KB Time limit exceeded
19 Correct 850 ms 39728 KB Output is correct
20 Execution timed out 1098 ms 39760 KB Time limit exceeded
21 Correct 114 ms 40308 KB Output is correct
22 Execution timed out 1083 ms 39784 KB Time limit exceeded
23 Execution timed out 1085 ms 39516 KB Time limit exceeded
24 Correct 690 ms 39620 KB Output is correct
25 Execution timed out 1098 ms 39752 KB Time limit exceeded
26 Execution timed out 1093 ms 39724 KB Time limit exceeded
27 Execution timed out 1093 ms 39876 KB Time limit exceeded
28 Correct 650 ms 39696 KB Output is correct
29 Execution timed out 1096 ms 39756 KB Time limit exceeded
30 Execution timed out 1096 ms 39668 KB Time limit exceeded
31 Execution timed out 1094 ms 39720 KB Time limit exceeded
32 Execution timed out 1091 ms 39732 KB Time limit exceeded
33 Correct 670 ms 39696 KB Output is correct
34 Execution timed out 1077 ms 39824 KB Time limit exceeded
35 Execution timed out 1100 ms 39840 KB Time limit exceeded
36 Execution timed out 1095 ms 39756 KB Time limit exceeded
37 Execution timed out 1099 ms 39780 KB Time limit exceeded
38 Execution timed out 1100 ms 39496 KB Time limit exceeded
39 Execution timed out 1092 ms 39864 KB Time limit exceeded
40 Execution timed out 1095 ms 39480 KB Time limit exceeded
41 Execution timed out 1099 ms 39756 KB Time limit exceeded
42 Execution timed out 1097 ms 39832 KB Time limit exceeded