#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=1e7;
ll m, q, x, u=N, a[N+5], b[N+5], j;
main(){
cin>>m>>q;
for (int i=1; i<=u+1; i++)a[i]=b[i]=u;
for (int i=1; i<=m&&!(j*=0); i++)
for (cin>>x; j+x-1<=u; j+=x)a[j+x-1]=min(a[j+x-1],j);
for (int i=u; i; i--)a[u]=min(a[u],a[u+1]);
for (int i=1; i<=u; i++)b[i]=b[a[i]]+1;
while(cin>>x)
if(b[x]<u)cout<<b[x]<<'\n';
else cout<<"oo\n";
}
Compilation message
brunhilda.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | main(){
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
120 ms |
156812 KB |
Output isn't correct |
2 |
Incorrect |
152 ms |
156740 KB |
Output isn't correct |
3 |
Incorrect |
141 ms |
156792 KB |
Output isn't correct |
4 |
Incorrect |
125 ms |
156836 KB |
Output isn't correct |
5 |
Incorrect |
143 ms |
156836 KB |
Output isn't correct |
6 |
Incorrect |
126 ms |
156760 KB |
Output isn't correct |
7 |
Incorrect |
135 ms |
156740 KB |
Output isn't correct |
8 |
Incorrect |
143 ms |
156788 KB |
Output isn't correct |
9 |
Incorrect |
167 ms |
156740 KB |
Output isn't correct |
10 |
Incorrect |
189 ms |
156784 KB |
Output isn't correct |
11 |
Incorrect |
174 ms |
156828 KB |
Output isn't correct |
12 |
Incorrect |
114 ms |
156836 KB |
Output isn't correct |
13 |
Incorrect |
299 ms |
156728 KB |
Output isn't correct |
14 |
Incorrect |
317 ms |
156936 KB |
Output isn't correct |
15 |
Incorrect |
162 ms |
156828 KB |
Output isn't correct |
16 |
Incorrect |
155 ms |
156740 KB |
Output isn't correct |
17 |
Incorrect |
149 ms |
156856 KB |
Output isn't correct |
18 |
Incorrect |
136 ms |
156968 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
138 ms |
156828 KB |
Output isn't correct |
2 |
Incorrect |
191 ms |
156740 KB |
Output isn't correct |
3 |
Incorrect |
383 ms |
156868 KB |
Output isn't correct |
4 |
Incorrect |
164 ms |
156832 KB |
Output isn't correct |
5 |
Incorrect |
300 ms |
156828 KB |
Output isn't correct |
6 |
Incorrect |
158 ms |
156808 KB |
Output isn't correct |
7 |
Incorrect |
141 ms |
156828 KB |
Output isn't correct |
8 |
Incorrect |
152 ms |
156740 KB |
Output isn't correct |
9 |
Incorrect |
318 ms |
156832 KB |
Output isn't correct |
10 |
Incorrect |
367 ms |
156844 KB |
Output isn't correct |
11 |
Incorrect |
369 ms |
156832 KB |
Output isn't correct |
12 |
Incorrect |
206 ms |
156848 KB |
Output isn't correct |
13 |
Incorrect |
135 ms |
156824 KB |
Output isn't correct |
14 |
Incorrect |
165 ms |
156828 KB |
Output isn't correct |
15 |
Incorrect |
332 ms |
156884 KB |
Output isn't correct |
16 |
Incorrect |
184 ms |
156740 KB |
Output isn't correct |
17 |
Incorrect |
313 ms |
156740 KB |
Output isn't correct |
18 |
Incorrect |
340 ms |
156740 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
412 ms |
156996 KB |
Output isn't correct |
2 |
Incorrect |
409 ms |
156928 KB |
Output isn't correct |
3 |
Incorrect |
468 ms |
157032 KB |
Output isn't correct |
4 |
Incorrect |
369 ms |
157096 KB |
Output isn't correct |
5 |
Incorrect |
381 ms |
157288 KB |
Output isn't correct |
6 |
Incorrect |
487 ms |
157124 KB |
Output isn't correct |
7 |
Incorrect |
383 ms |
157120 KB |
Output isn't correct |
8 |
Incorrect |
422 ms |
157004 KB |
Output isn't correct |
9 |
Incorrect |
393 ms |
156960 KB |
Output isn't correct |
10 |
Incorrect |
263 ms |
156896 KB |
Output isn't correct |
11 |
Incorrect |
234 ms |
156868 KB |
Output isn't correct |
12 |
Incorrect |
308 ms |
156840 KB |
Output isn't correct |
13 |
Incorrect |
483 ms |
157152 KB |
Output isn't correct |
14 |
Incorrect |
379 ms |
157128 KB |
Output isn't correct |
15 |
Incorrect |
348 ms |
156888 KB |
Output isn't correct |
16 |
Incorrect |
352 ms |
156952 KB |
Output isn't correct |
17 |
Incorrect |
306 ms |
156904 KB |
Output isn't correct |
18 |
Incorrect |
443 ms |
156988 KB |
Output isn't correct |
19 |
Incorrect |
172 ms |
156896 KB |
Output isn't correct |
20 |
Incorrect |
477 ms |
156968 KB |
Output isn't correct |
21 |
Incorrect |
400 ms |
157100 KB |
Output isn't correct |
22 |
Incorrect |
575 ms |
157212 KB |
Output isn't correct |
23 |
Incorrect |
352 ms |
157136 KB |
Output isn't correct |
24 |
Incorrect |
302 ms |
157132 KB |
Output isn't correct |
25 |
Incorrect |
400 ms |
157136 KB |
Output isn't correct |
26 |
Incorrect |
376 ms |
157084 KB |
Output isn't correct |
27 |
Incorrect |
549 ms |
156980 KB |
Output isn't correct |
28 |
Incorrect |
319 ms |
157124 KB |
Output isn't correct |
29 |
Incorrect |
519 ms |
157124 KB |
Output isn't correct |
30 |
Incorrect |
511 ms |
157124 KB |
Output isn't correct |
31 |
Incorrect |
320 ms |
157124 KB |
Output isn't correct |
32 |
Incorrect |
330 ms |
157284 KB |
Output isn't correct |
33 |
Incorrect |
275 ms |
156996 KB |
Output isn't correct |
34 |
Incorrect |
428 ms |
156960 KB |
Output isn't correct |
35 |
Incorrect |
329 ms |
157104 KB |
Output isn't correct |
36 |
Incorrect |
569 ms |
157208 KB |
Output isn't correct |
37 |
Incorrect |
390 ms |
157124 KB |
Output isn't correct |
38 |
Incorrect |
442 ms |
157400 KB |
Output isn't correct |
39 |
Incorrect |
313 ms |
157148 KB |
Output isn't correct |
40 |
Incorrect |
430 ms |
157260 KB |
Output isn't correct |
41 |
Incorrect |
395 ms |
156972 KB |
Output isn't correct |
42 |
Incorrect |
490 ms |
157268 KB |
Output isn't correct |