Submission #493676

# Submission time Handle Problem Language Result Execution time Memory
493676 2021-12-12T14:25:32 Z _Monkey_ Brunhilda’s Birthday (BOI13_brunhilda) C++17
20 / 100
1000 ms 18116 KB
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define el '\n'
#define ld long double
const int maxn=1e6+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];
    f[z]=oo;
    for(int i=0;i<m;++i) if(z%a[i]!=0) f[z]=min(f[z],take(z-z%a[i])+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 Correct 2 ms 4172 KB Output is correct
2 Correct 3 ms 4172 KB Output is correct
3 Correct 2 ms 4300 KB Output is correct
4 Correct 8 ms 4300 KB Output is correct
5 Correct 2 ms 4172 KB Output is correct
6 Correct 2 ms 4172 KB Output is correct
7 Correct 2 ms 4300 KB Output is correct
8 Correct 2 ms 4300 KB Output is correct
9 Correct 2 ms 4172 KB Output is correct
10 Correct 3 ms 4300 KB Output is correct
11 Correct 3 ms 4392 KB Output is correct
12 Correct 2 ms 4172 KB Output is correct
13 Correct 56 ms 4428 KB Output is correct
14 Correct 48 ms 4288 KB Output is correct
15 Correct 3 ms 4172 KB Output is correct
16 Correct 3 ms 4172 KB Output is correct
17 Correct 7 ms 4300 KB Output is correct
18 Correct 7 ms 4300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 8524 KB Execution killed with signal 11
2 Runtime error 15 ms 9720 KB Execution killed with signal 11
3 Runtime error 12 ms 9420 KB Execution killed with signal 11
4 Incorrect 2 ms 4236 KB Output isn't correct
5 Runtime error 10 ms 9164 KB Execution killed with signal 11
6 Runtime error 6 ms 8396 KB Execution killed with signal 11
7 Runtime error 7 ms 8544 KB Execution killed with signal 11
8 Runtime error 6 ms 8332 KB Execution killed with signal 11
9 Runtime error 11 ms 9376 KB Execution killed with signal 11
10 Runtime error 11 ms 9344 KB Execution killed with signal 11
11 Runtime error 8 ms 8912 KB Execution killed with signal 11
12 Runtime error 6 ms 8396 KB Execution killed with signal 11
13 Runtime error 6 ms 8348 KB Execution killed with signal 11
14 Runtime error 6 ms 8396 KB Execution killed with signal 11
15 Runtime error 10 ms 8948 KB Execution killed with signal 11
16 Runtime error 15 ms 9816 KB Execution killed with signal 11
17 Runtime error 7 ms 8344 KB Execution killed with signal 11
18 Runtime error 15 ms 9796 KB Execution killed with signal 11
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 9292 KB Execution killed with signal 11
2 Execution timed out 1076 ms 18116 KB Time limit exceeded
3 Runtime error 10 ms 9164 KB Execution killed with signal 11
4 Runtime error 6 ms 8524 KB Execution killed with signal 11
5 Runtime error 16 ms 10188 KB Execution killed with signal 11
6 Runtime error 7 ms 8600 KB Execution killed with signal 11
7 Runtime error 14 ms 10004 KB Execution killed with signal 11
8 Runtime error 11 ms 9292 KB Execution killed with signal 11
9 Runtime error 9 ms 9188 KB Execution killed with signal 11
10 Execution timed out 1090 ms 12236 KB Time limit exceeded
11 Runtime error 8 ms 8524 KB Execution killed with signal 11
12 Runtime error 7 ms 8468 KB Execution killed with signal 11
13 Runtime error 8 ms 8908 KB Execution killed with signal 11
14 Runtime error 5 ms 8396 KB Execution killed with signal 11
15 Runtime error 6 ms 8524 KB Execution killed with signal 11
16 Runtime error 6 ms 8624 KB Execution killed with signal 11
17 Runtime error 9 ms 9036 KB Execution killed with signal 11
18 Execution timed out 1083 ms 18108 KB Time limit exceeded
19 Runtime error 7 ms 8524 KB Execution killed with signal 11
20 Runtime error 10 ms 9232 KB Execution killed with signal 11
21 Runtime error 6 ms 8396 KB Execution killed with signal 11
22 Runtime error 13 ms 10060 KB Execution killed with signal 11
23 Runtime error 8 ms 8976 KB Execution killed with signal 11
24 Runtime error 6 ms 8348 KB Execution killed with signal 11
25 Execution timed out 1089 ms 10700 KB Time limit exceeded
26 Runtime error 5 ms 8492 KB Execution killed with signal 11
27 Runtime error 13 ms 9964 KB Execution killed with signal 11
28 Runtime error 6 ms 8396 KB Execution killed with signal 11
29 Runtime error 14 ms 10060 KB Execution killed with signal 11
30 Runtime error 11 ms 9548 KB Execution killed with signal 11
31 Runtime error 7 ms 8524 KB Execution killed with signal 11
32 Runtime error 6 ms 8524 KB Execution killed with signal 11
33 Runtime error 5 ms 8396 KB Execution killed with signal 11
34 Runtime error 13 ms 9940 KB Execution killed with signal 11
35 Runtime error 6 ms 8468 KB Execution killed with signal 11
36 Runtime error 13 ms 9932 KB Execution killed with signal 11
37 Runtime error 15 ms 10072 KB Execution killed with signal 11
38 Runtime error 6 ms 8652 KB Execution killed with signal 11
39 Runtime error 6 ms 8524 KB Execution killed with signal 11
40 Runtime error 8 ms 8700 KB Execution killed with signal 11
41 Runtime error 14 ms 10080 KB Execution killed with signal 11
42 Runtime error 7 ms 8524 KB Execution killed with signal 11