#include <bits/stdc++.h>
using namespace std;
int n,q;
int a[100009];
int main()
{
cin>>n>>q;
for(int i=0;i<n;i++)cin>>a[i];
sort(a,a+n);
int x;
while (q--)
{
cin>>x;
int re=0;
bool r=0;
for(int i=n-1;i>-1;i--)
{
if (x<a[n-1])
{
r=1;
cout<<re+1;
break;
}
if (x==0)
{
r=1;
cout<<re<<endl;break;
}
x=x-(x%a[i]);
re++;
}
if (r==0&&x<a[n-1])
cout<<re+1<<endl;
else if (r==0)cout<<"00"<<endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
256 KB |
Output isn't correct |
2 |
Incorrect |
3 ms |
256 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
4 |
Incorrect |
32 ms |
376 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
6 |
Incorrect |
5 ms |
256 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
296 KB |
Output isn't correct |
10 |
Incorrect |
5 ms |
256 KB |
Output isn't correct |
11 |
Incorrect |
6 ms |
376 KB |
Output isn't correct |
12 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
13 |
Incorrect |
5 ms |
380 KB |
Output isn't correct |
14 |
Incorrect |
31 ms |
380 KB |
Output isn't correct |
15 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
16 |
Incorrect |
4 ms |
376 KB |
Output isn't correct |
17 |
Incorrect |
39 ms |
376 KB |
Output isn't correct |
18 |
Incorrect |
32 ms |
380 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
376 KB |
Output isn't correct |
2 |
Incorrect |
61 ms |
1400 KB |
Output isn't correct |
3 |
Correct |
43 ms |
1144 KB |
Output is correct |
4 |
Incorrect |
4 ms |
376 KB |
Output isn't correct |
5 |
Correct |
32 ms |
888 KB |
Output is correct |
6 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
7 |
Incorrect |
9 ms |
376 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
9 |
Incorrect |
44 ms |
1144 KB |
Output isn't correct |
10 |
Correct |
42 ms |
1144 KB |
Output is correct |
11 |
Incorrect |
25 ms |
760 KB |
Output isn't correct |
12 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
13 |
Incorrect |
4 ms |
376 KB |
Output isn't correct |
14 |
Incorrect |
4 ms |
376 KB |
Output isn't correct |
15 |
Incorrect |
26 ms |
764 KB |
Output isn't correct |
16 |
Incorrect |
61 ms |
1372 KB |
Output isn't correct |
17 |
Incorrect |
4 ms |
376 KB |
Output isn't correct |
18 |
Incorrect |
64 ms |
1576 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1081 ms |
1068 KB |
Time limit exceeded |
2 |
Execution timed out |
1078 ms |
1272 KB |
Time limit exceeded |
3 |
Execution timed out |
1085 ms |
1056 KB |
Time limit exceeded |
4 |
Execution timed out |
1077 ms |
860 KB |
Time limit exceeded |
5 |
Execution timed out |
1081 ms |
1892 KB |
Time limit exceeded |
6 |
Execution timed out |
1075 ms |
848 KB |
Time limit exceeded |
7 |
Execution timed out |
1080 ms |
1644 KB |
Time limit exceeded |
8 |
Execution timed out |
1081 ms |
1184 KB |
Time limit exceeded |
9 |
Execution timed out |
1082 ms |
1016 KB |
Time limit exceeded |
10 |
Incorrect |
777 ms |
760 KB |
Output isn't correct |
11 |
Execution timed out |
1086 ms |
764 KB |
Time limit exceeded |
12 |
Execution timed out |
1081 ms |
656 KB |
Time limit exceeded |
13 |
Execution timed out |
1076 ms |
856 KB |
Time limit exceeded |
14 |
Incorrect |
344 ms |
1416 KB |
Output isn't correct |
15 |
Execution timed out |
1092 ms |
632 KB |
Time limit exceeded |
16 |
Execution timed out |
1074 ms |
884 KB |
Time limit exceeded |
17 |
Execution timed out |
1073 ms |
888 KB |
Time limit exceeded |
18 |
Execution timed out |
1086 ms |
1020 KB |
Time limit exceeded |
19 |
Incorrect |
966 ms |
656 KB |
Output isn't correct |
20 |
Execution timed out |
1073 ms |
1096 KB |
Time limit exceeded |
21 |
Incorrect |
445 ms |
1532 KB |
Output isn't correct |
22 |
Execution timed out |
1083 ms |
1656 KB |
Time limit exceeded |
23 |
Execution timed out |
1077 ms |
1020 KB |
Time limit exceeded |
24 |
Execution timed out |
1086 ms |
1388 KB |
Time limit exceeded |
25 |
Execution timed out |
1078 ms |
1012 KB |
Time limit exceeded |
26 |
Execution timed out |
1092 ms |
888 KB |
Time limit exceeded |
27 |
Execution timed out |
1088 ms |
1656 KB |
Time limit exceeded |
28 |
Execution timed out |
1067 ms |
1352 KB |
Time limit exceeded |
29 |
Execution timed out |
1077 ms |
1656 KB |
Time limit exceeded |
30 |
Execution timed out |
1078 ms |
1264 KB |
Time limit exceeded |
31 |
Execution timed out |
1065 ms |
1064 KB |
Time limit exceeded |
32 |
Execution timed out |
1072 ms |
1024 KB |
Time limit exceeded |
33 |
Execution timed out |
1073 ms |
1524 KB |
Time limit exceeded |
34 |
Execution timed out |
1088 ms |
1656 KB |
Time limit exceeded |
35 |
Execution timed out |
1074 ms |
928 KB |
Time limit exceeded |
36 |
Execution timed out |
1075 ms |
1656 KB |
Time limit exceeded |
37 |
Execution timed out |
1078 ms |
1772 KB |
Time limit exceeded |
38 |
Execution timed out |
1065 ms |
1016 KB |
Time limit exceeded |
39 |
Execution timed out |
1087 ms |
1084 KB |
Time limit exceeded |
40 |
Execution timed out |
1070 ms |
888 KB |
Time limit exceeded |
41 |
Incorrect |
244 ms |
1912 KB |
Output isn't correct |
42 |
Execution timed out |
1080 ms |
896 KB |
Time limit exceeded |