#include <bits/stdc++.h>
using namespace std;
#define ll long long
long long m, q, pd=1, x, vl;
vector<ll> p;
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>m>>q;
for (int i=1; i<=m; i++) cin>>x, pd=min((long long)10000005, pd*x), p.push_back(x);
while (q--)
{
cin>>vl;
long long tmp=vl/x*x, res=0;
for (auto t:p) if (vl-(vl%t)<tmp) res=1;
if (vl>=pd) cout<<"oo\n";
else cout<<2*(vl/x)+((vl%x)!=0)-res<<'\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
460 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Incorrect |
5 ms |
344 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
460 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
11 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
5 ms |
348 KB |
Output is correct |
14 |
Incorrect |
41 ms |
344 KB |
Output isn't correct |
15 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
16 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
17 |
Incorrect |
4 ms |
348 KB |
Output isn't correct |
18 |
Incorrect |
5 ms |
508 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
604 KB |
Output isn't correct |
2 |
Incorrect |
7 ms |
2268 KB |
Output isn't correct |
3 |
Correct |
5 ms |
2008 KB |
Output is correct |
4 |
Incorrect |
1 ms |
468 KB |
Output isn't correct |
5 |
Correct |
4 ms |
1248 KB |
Output is correct |
6 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
604 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
9 |
Correct |
5 ms |
2012 KB |
Output is correct |
10 |
Correct |
6 ms |
2012 KB |
Output is correct |
11 |
Incorrect |
3 ms |
1368 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
15 |
Incorrect |
4 ms |
1248 KB |
Output isn't correct |
16 |
Incorrect |
7 ms |
2264 KB |
Output isn't correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
9 ms |
2012 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1055 ms |
1472 KB |
Time limit exceeded |
2 |
Execution timed out |
1006 ms |
1496 KB |
Time limit exceeded |
3 |
Execution timed out |
1049 ms |
1460 KB |
Time limit exceeded |
4 |
Execution timed out |
1066 ms |
1200 KB |
Time limit exceeded |
5 |
Execution timed out |
1047 ms |
2488 KB |
Time limit exceeded |
6 |
Execution timed out |
1062 ms |
1008 KB |
Time limit exceeded |
7 |
Execution timed out |
1060 ms |
2264 KB |
Time limit exceeded |
8 |
Execution timed out |
1046 ms |
1492 KB |
Time limit exceeded |
9 |
Execution timed out |
1027 ms |
1464 KB |
Time limit exceeded |
10 |
Incorrect |
352 ms |
688 KB |
Output isn't correct |
11 |
Incorrect |
515 ms |
908 KB |
Output isn't correct |
12 |
Incorrect |
689 ms |
1044 KB |
Output isn't correct |
13 |
Execution timed out |
1008 ms |
1452 KB |
Time limit exceeded |
14 |
Incorrect |
33 ms |
1708 KB |
Output isn't correct |
15 |
Incorrect |
734 ms |
1108 KB |
Output isn't correct |
16 |
Incorrect |
807 ms |
816 KB |
Output isn't correct |
17 |
Execution timed out |
1066 ms |
1328 KB |
Time limit exceeded |
18 |
Execution timed out |
1061 ms |
1776 KB |
Time limit exceeded |
19 |
Incorrect |
531 ms |
600 KB |
Output isn't correct |
20 |
Execution timed out |
1035 ms |
1496 KB |
Time limit exceeded |
21 |
Incorrect |
81 ms |
1740 KB |
Output isn't correct |
22 |
Execution timed out |
1068 ms |
2240 KB |
Time limit exceeded |
23 |
Execution timed out |
1047 ms |
1316 KB |
Time limit exceeded |
24 |
Incorrect |
575 ms |
1372 KB |
Output isn't correct |
25 |
Execution timed out |
1034 ms |
1456 KB |
Time limit exceeded |
26 |
Execution timed out |
1032 ms |
1628 KB |
Time limit exceeded |
27 |
Execution timed out |
1034 ms |
2260 KB |
Time limit exceeded |
28 |
Incorrect |
565 ms |
2332 KB |
Output isn't correct |
29 |
Execution timed out |
1018 ms |
2264 KB |
Time limit exceeded |
30 |
Execution timed out |
1044 ms |
2008 KB |
Time limit exceeded |
31 |
Execution timed out |
1066 ms |
1376 KB |
Time limit exceeded |
32 |
Execution timed out |
1031 ms |
1596 KB |
Time limit exceeded |
33 |
Incorrect |
574 ms |
1412 KB |
Output isn't correct |
34 |
Execution timed out |
1068 ms |
2260 KB |
Time limit exceeded |
35 |
Execution timed out |
1100 ms |
1588 KB |
Time limit exceeded |
36 |
Execution timed out |
1058 ms |
2012 KB |
Time limit exceeded |
37 |
Execution timed out |
1045 ms |
2364 KB |
Time limit exceeded |
38 |
Execution timed out |
1069 ms |
960 KB |
Time limit exceeded |
39 |
Execution timed out |
1054 ms |
1520 KB |
Time limit exceeded |
40 |
Execution timed out |
1050 ms |
860 KB |
Time limit exceeded |
41 |
Execution timed out |
1047 ms |
2264 KB |
Time limit exceeded |
42 |
Execution timed out |
1033 ms |
1216 KB |
Time limit exceeded |