Submission #923234

# Submission time Handle Problem Language Result Execution time Memory
923234 2024-02-07T02:37:39 Z ttamx Brunhilda’s Birthday (BOI13_brunhilda) C++14
27.9365 / 100
308 ms 160144 KB
#include<bits/stdc++.h>

using namespace std;

const int N=1e7+5;

int m,q;
int mx;
int p[N],dp[N];

int main(){
    cin.tie(nullptr)->sync_with_stdio(false);
    cin >> m >> q;
    for(int i=0;i<m;i++){
        int x;
        cin >> x;
        for(int i=0;i<N;i+=x)p[i]=max(p[i],x);
    }
    for(int l=0,r=0,cnt=0;l<N&&l<=r;l=r+1,r=mx,cnt++){
        for(int i=l;i<=r;i++){
            dp[i]=cnt;
            mx=max(mx,i+p[i]-1);
        }
    }
    while(q--){
        int n;
        cin >> n;
        if(n>mx)cout << "oo\n";
        else cout << dp[n] << "\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 23 ms 39516 KB Output is correct
2 Correct 57 ms 78932 KB Output is correct
3 Correct 33 ms 41812 KB Output is correct
4 Correct 42 ms 78736 KB Output is correct
5 Correct 49 ms 78700 KB Output is correct
6 Correct 23 ms 39592 KB Output is correct
7 Correct 32 ms 41820 KB Output is correct
8 Correct 37 ms 43860 KB Output is correct
9 Correct 62 ms 78932 KB Output is correct
10 Correct 75 ms 78672 KB Output is correct
11 Correct 68 ms 78676 KB Output is correct
12 Correct 39 ms 78684 KB Output is correct
13 Correct 142 ms 78516 KB Output is correct
14 Correct 139 ms 78756 KB Output is correct
15 Correct 60 ms 78672 KB Output is correct
16 Correct 57 ms 78720 KB Output is correct
17 Correct 55 ms 78768 KB Output is correct
18 Correct 40 ms 78672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 118 ms 159316 KB Execution killed with signal 11
2 Runtime error 133 ms 159804 KB Execution killed with signal 11
3 Runtime error 262 ms 159920 KB Execution killed with signal 11
4 Runtime error 133 ms 159160 KB Execution killed with signal 11
5 Runtime error 189 ms 159572 KB Execution killed with signal 11
6 Runtime error 127 ms 159272 KB Execution killed with signal 11
7 Runtime error 122 ms 159312 KB Execution killed with signal 11
8 Runtime error 137 ms 159284 KB Execution killed with signal 11
9 Runtime error 234 ms 159640 KB Execution killed with signal 11
10 Runtime error 255 ms 159612 KB Execution killed with signal 11
11 Runtime error 265 ms 159312 KB Execution killed with signal 11
12 Correct 91 ms 78508 KB Output is correct
13 Runtime error 111 ms 159188 KB Execution killed with signal 11
14 Runtime error 136 ms 159316 KB Execution killed with signal 11
15 Runtime error 221 ms 159588 KB Execution killed with signal 11
16 Runtime error 129 ms 159840 KB Execution killed with signal 11
17 Correct 148 ms 78516 KB Output is correct
18 Runtime error 223 ms 159940 KB Execution killed with signal 11
# Verdict Execution time Memory Grader output
1 Runtime error 209 ms 159568 KB Execution killed with signal 11
2 Runtime error 259 ms 159568 KB Execution killed with signal 11
3 Runtime error 254 ms 159580 KB Execution killed with signal 11
4 Correct 110 ms 79540 KB Output is correct
5 Runtime error 138 ms 160012 KB Execution killed with signal 11
6 Runtime error 206 ms 159404 KB Execution killed with signal 11
7 Runtime error 214 ms 160132 KB Execution killed with signal 11
8 Runtime error 217 ms 159572 KB Execution killed with signal 11
9 Runtime error 215 ms 159660 KB Execution killed with signal 11
10 Runtime error 180 ms 159312 KB Execution killed with signal 11
11 Runtime error 159 ms 159568 KB Execution killed with signal 11
12 Runtime error 191 ms 159156 KB Execution killed with signal 11
13 Runtime error 228 ms 159528 KB Execution killed with signal 11
14 Correct 96 ms 79956 KB Output is correct
15 Runtime error 230 ms 159316 KB Execution killed with signal 11
16 Runtime error 225 ms 159312 KB Execution killed with signal 11
17 Runtime error 209 ms 159572 KB Execution killed with signal 11
18 Runtime error 258 ms 159568 KB Execution killed with signal 11
19 Runtime error 114 ms 159196 KB Execution killed with signal 11
20 Runtime error 262 ms 159592 KB Execution killed with signal 11
21 Correct 112 ms 79896 KB Output is correct
22 Runtime error 271 ms 160144 KB Execution killed with signal 11
23 Runtime error 134 ms 159504 KB Execution killed with signal 11
24 Runtime error 112 ms 159316 KB Execution killed with signal 11
25 Runtime error 166 ms 159312 KB Execution killed with signal 11
26 Correct 109 ms 79440 KB Output is correct
27 Runtime error 308 ms 159936 KB Execution killed with signal 11
28 Runtime error 123 ms 159328 KB Execution killed with signal 11
29 Runtime error 234 ms 160084 KB Execution killed with signal 11
30 Runtime error 216 ms 159828 KB Execution killed with signal 11
31 Runtime error 140 ms 159184 KB Execution killed with signal 11
32 Runtime error 140 ms 159240 KB Execution killed with signal 11
33 Runtime error 102 ms 159136 KB Execution killed with signal 11
34 Runtime error 213 ms 160020 KB Execution killed with signal 11
35 Runtime error 122 ms 159164 KB Execution killed with signal 11
36 Runtime error 236 ms 159936 KB Execution killed with signal 11
37 Runtime error 143 ms 160024 KB Execution killed with signal 11
38 Runtime error 210 ms 159408 KB Execution killed with signal 11
39 Runtime error 120 ms 159316 KB Execution killed with signal 11
40 Runtime error 205 ms 159512 KB Execution killed with signal 11
41 Runtime error 173 ms 160080 KB Execution killed with signal 11
42 Runtime error 221 ms 159396 KB Execution killed with signal 11