Submission #493721

# Submission time Handle Problem Language Result Execution time Memory
493721 2021-12-12T17:47:50 Z _Monkey_ Brunhilda’s Birthday (BOI13_brunhilda) C++17
0 / 100
14 ms 1652 KB
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define el '\n'
#define ld long double
const int maxn=1e5+1,nn=101;
void amax(int &x,int y){if(y>x)x=y;}
int a[maxn],f[nn],ut[nn];
int m,n,q,oo=1e9,p;
bool ok;
int take(int z){
    if(f[z]>=0) return f[z];
    if(ut[z]==0){
        f[z]=oo;
    } else {
        f[z]=min(oo,take(z-ut[z])+1);
    }
    return f[z];
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin >> m >> q;
    for(int i=0;i<m;++i) cin >> a[i];
    sort(a+0,a+m);
    for(int i=0;i<m;++i)
        for(int j=a[i]-1;j<nn;j+=a[i]) ut[j]=a[i]-1;
    for(int i=nn-2;i>0;--i) amax(ut[i],ut[i+1]-1);
    memset(f,-1,sizeof f);
    f[0]=0;
    while(q--){
        cin >> n;
        p=take(n);
        if(p==oo){
            cout << "oo" << el;
        } else {
            cout << p << el;
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Incorrect 2 ms 332 KB Output isn't correct
5 Incorrect 1 ms 204 KB Output isn't correct
6 Incorrect 1 ms 204 KB Output isn't correct
7 Incorrect 0 ms 204 KB Output isn't correct
8 Incorrect 0 ms 204 KB Output isn't correct
9 Incorrect 0 ms 204 KB Output isn't correct
10 Incorrect 1 ms 320 KB Output isn't correct
11 Incorrect 1 ms 204 KB Output isn't correct
12 Incorrect 0 ms 204 KB Output isn't correct
13 Incorrect 1 ms 332 KB Output isn't correct
14 Incorrect 2 ms 332 KB Output isn't correct
15 Incorrect 1 ms 204 KB Output isn't correct
16 Incorrect 1 ms 320 KB Output isn't correct
17 Incorrect 2 ms 332 KB Output isn't correct
18 Incorrect 2 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 588 KB Execution killed with signal 11
2 Runtime error 10 ms 1612 KB Execution killed with signal 11
3 Runtime error 8 ms 1228 KB Execution killed with signal 11
4 Runtime error 1 ms 460 KB Execution killed with signal 11
5 Runtime error 5 ms 1100 KB Execution killed with signal 11
6 Runtime error 1 ms 460 KB Execution killed with signal 11
7 Runtime error 2 ms 588 KB Execution killed with signal 11
8 Runtime error 1 ms 460 KB Execution killed with signal 11
9 Runtime error 8 ms 1228 KB Execution killed with signal 11
10 Runtime error 8 ms 1228 KB Execution killed with signal 11
11 Runtime error 5 ms 972 KB Execution killed with signal 11
12 Runtime error 1 ms 460 KB Execution killed with signal 11
13 Runtime error 1 ms 452 KB Execution killed with signal 11
14 Runtime error 1 ms 460 KB Execution killed with signal 11
15 Runtime error 4 ms 972 KB Execution killed with signal 11
16 Runtime error 12 ms 1488 KB Execution killed with signal 11
17 Runtime error 1 ms 460 KB Execution killed with signal 11
18 Runtime error 11 ms 1612 KB Execution killed with signal 11
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 1096 KB Execution killed with signal 11
2 Runtime error 6 ms 1080 KB Execution killed with signal 11
3 Runtime error 6 ms 1100 KB Execution killed with signal 11
4 Runtime error 1 ms 588 KB Execution killed with signal 11
5 Runtime error 14 ms 1464 KB Execution killed with signal 11
6 Runtime error 2 ms 656 KB Execution killed with signal 11
7 Runtime error 11 ms 1484 KB Execution killed with signal 11
8 Runtime error 6 ms 1100 KB Execution killed with signal 11
9 Runtime error 5 ms 1100 KB Execution killed with signal 11
10 Runtime error 2 ms 588 KB Execution killed with signal 11
11 Runtime error 1 ms 460 KB Execution killed with signal 11
12 Runtime error 1 ms 588 KB Execution killed with signal 11
13 Runtime error 4 ms 844 KB Execution killed with signal 11
14 Runtime error 1 ms 564 KB Execution killed with signal 11
15 Runtime error 1 ms 460 KB Execution killed with signal 11
16 Runtime error 1 ms 588 KB Execution killed with signal 11
17 Runtime error 5 ms 984 KB Execution killed with signal 11
18 Runtime error 5 ms 1100 KB Execution killed with signal 11
19 Runtime error 1 ms 588 KB Execution killed with signal 11
20 Runtime error 6 ms 1100 KB Execution killed with signal 11
21 Runtime error 1 ms 460 KB Execution killed with signal 11
22 Runtime error 12 ms 1652 KB Execution killed with signal 11
23 Runtime error 4 ms 840 KB Execution killed with signal 11
24 Runtime error 1 ms 460 KB Execution killed with signal 11
25 Runtime error 1 ms 588 KB Execution killed with signal 11
26 Runtime error 1 ms 556 KB Execution killed with signal 11
27 Runtime error 11 ms 1612 KB Execution killed with signal 11
28 Runtime error 1 ms 460 KB Execution killed with signal 11
29 Runtime error 12 ms 1484 KB Execution killed with signal 11
30 Runtime error 9 ms 1272 KB Execution killed with signal 11
31 Runtime error 1 ms 588 KB Execution killed with signal 11
32 Runtime error 1 ms 460 KB Execution killed with signal 11
33 Runtime error 1 ms 460 KB Execution killed with signal 11
34 Runtime error 12 ms 1612 KB Execution killed with signal 11
35 Runtime error 1 ms 460 KB Execution killed with signal 11
36 Runtime error 10 ms 1356 KB Execution killed with signal 11
37 Runtime error 11 ms 1400 KB Execution killed with signal 11
38 Runtime error 1 ms 460 KB Execution killed with signal 11
39 Runtime error 1 ms 460 KB Execution killed with signal 11
40 Runtime error 2 ms 460 KB Execution killed with signal 11
41 Runtime error 11 ms 1356 KB Execution killed with signal 11
42 Runtime error 1 ms 460 KB Execution killed with signal 11