m,q = map(int, input().split())
lis = list(map(int, input().split()))
nums = []
for i in range(q):
nums.append(int(input()))
for i in nums:
cnt = 0
while i > 0:
mini = 1000000000
for j in lis:
mini = min(mini, i-i%j)
if mini == i:
print("oo")
break
i = mini
cnt += 1
if i==0:
print(cnt)
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
104 ms |
22504 KB |
Output is correct |
2 |
Correct |
72 ms |
20244 KB |
Output is correct |
3 |
Correct |
50 ms |
19120 KB |
Output is correct |
4 |
Correct |
153 ms |
25248 KB |
Output is correct |
5 |
Correct |
77 ms |
19980 KB |
Output is correct |
6 |
Correct |
94 ms |
22496 KB |
Output is correct |
7 |
Correct |
45 ms |
19244 KB |
Output is correct |
8 |
Correct |
51 ms |
19088 KB |
Output is correct |
9 |
Correct |
56 ms |
19056 KB |
Output is correct |
10 |
Correct |
102 ms |
21828 KB |
Output is correct |
11 |
Correct |
118 ms |
21292 KB |
Output is correct |
12 |
Correct |
44 ms |
18868 KB |
Output is correct |
13 |
Correct |
81 ms |
20416 KB |
Output is correct |
14 |
Correct |
163 ms |
24552 KB |
Output is correct |
15 |
Correct |
67 ms |
19776 KB |
Output is correct |
16 |
Correct |
73 ms |
20276 KB |
Output is correct |
17 |
Correct |
168 ms |
25252 KB |
Output is correct |
18 |
Correct |
126 ms |
25212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
68 ms |
20008 KB |
Output is correct |
2 |
Correct |
65 ms |
29444 KB |
Output is correct |
3 |
Correct |
59 ms |
25808 KB |
Output is correct |
4 |
Correct |
57 ms |
19180 KB |
Output is correct |
5 |
Correct |
53 ms |
25292 KB |
Output is correct |
6 |
Correct |
49 ms |
19260 KB |
Output is correct |
7 |
Correct |
62 ms |
20036 KB |
Output is correct |
8 |
Correct |
45 ms |
18840 KB |
Output is correct |
9 |
Correct |
52 ms |
26052 KB |
Output is correct |
10 |
Correct |
55 ms |
25716 KB |
Output is correct |
11 |
Correct |
63 ms |
23724 KB |
Output is correct |
12 |
Correct |
61 ms |
19292 KB |
Output is correct |
13 |
Correct |
62 ms |
19492 KB |
Output is correct |
14 |
Correct |
53 ms |
19208 KB |
Output is correct |
15 |
Correct |
53 ms |
24252 KB |
Output is correct |
16 |
Correct |
60 ms |
29428 KB |
Output is correct |
17 |
Correct |
53 ms |
19264 KB |
Output is correct |
18 |
Correct |
62 ms |
29492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1070 ms |
25896 KB |
Time limit exceeded |
2 |
Execution timed out |
1084 ms |
25884 KB |
Time limit exceeded |
3 |
Execution timed out |
1089 ms |
26244 KB |
Time limit exceeded |
4 |
Execution timed out |
1094 ms |
27232 KB |
Time limit exceeded |
5 |
Execution timed out |
1087 ms |
30276 KB |
Time limit exceeded |
6 |
Execution timed out |
1075 ms |
27572 KB |
Time limit exceeded |
7 |
Execution timed out |
1084 ms |
30260 KB |
Time limit exceeded |
8 |
Execution timed out |
1085 ms |
25796 KB |
Time limit exceeded |
9 |
Execution timed out |
1082 ms |
25896 KB |
Time limit exceeded |
10 |
Execution timed out |
1076 ms |
24724 KB |
Time limit exceeded |
11 |
Execution timed out |
1090 ms |
25972 KB |
Time limit exceeded |
12 |
Execution timed out |
1074 ms |
25896 KB |
Time limit exceeded |
13 |
Execution timed out |
1087 ms |
28796 KB |
Time limit exceeded |
14 |
Execution timed out |
1079 ms |
26864 KB |
Time limit exceeded |
15 |
Execution timed out |
1098 ms |
26348 KB |
Time limit exceeded |
16 |
Execution timed out |
1087 ms |
25876 KB |
Time limit exceeded |
17 |
Execution timed out |
1054 ms |
25832 KB |
Time limit exceeded |
18 |
Execution timed out |
1064 ms |
25856 KB |
Time limit exceeded |
19 |
Execution timed out |
1080 ms |
25368 KB |
Time limit exceeded |
20 |
Execution timed out |
1090 ms |
26180 KB |
Time limit exceeded |
21 |
Execution timed out |
1086 ms |
26880 KB |
Time limit exceeded |
22 |
Execution timed out |
1086 ms |
29992 KB |
Time limit exceeded |
23 |
Execution timed out |
1085 ms |
28952 KB |
Time limit exceeded |
24 |
Execution timed out |
1081 ms |
27352 KB |
Time limit exceeded |
25 |
Execution timed out |
1085 ms |
27512 KB |
Time limit exceeded |
26 |
Execution timed out |
1087 ms |
26600 KB |
Time limit exceeded |
27 |
Execution timed out |
1076 ms |
30052 KB |
Time limit exceeded |
28 |
Execution timed out |
1068 ms |
27616 KB |
Time limit exceeded |
29 |
Execution timed out |
1080 ms |
29728 KB |
Time limit exceeded |
30 |
Execution timed out |
1099 ms |
27852 KB |
Time limit exceeded |
31 |
Execution timed out |
1093 ms |
27248 KB |
Time limit exceeded |
32 |
Execution timed out |
1051 ms |
27176 KB |
Time limit exceeded |
33 |
Execution timed out |
1095 ms |
27044 KB |
Time limit exceeded |
34 |
Execution timed out |
1066 ms |
30012 KB |
Time limit exceeded |
35 |
Execution timed out |
1094 ms |
27324 KB |
Time limit exceeded |
36 |
Execution timed out |
1075 ms |
29820 KB |
Time limit exceeded |
37 |
Execution timed out |
1093 ms |
30020 KB |
Time limit exceeded |
38 |
Execution timed out |
1091 ms |
28300 KB |
Time limit exceeded |
39 |
Execution timed out |
1100 ms |
27912 KB |
Time limit exceeded |
40 |
Execution timed out |
1065 ms |
27240 KB |
Time limit exceeded |
41 |
Execution timed out |
1059 ms |
29928 KB |
Time limit exceeded |
42 |
Execution timed out |
1030 ms |
27088 KB |
Time limit exceeded |