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)
print(i, i-mini)
if mini == i:
print("oo")
break
i = mini
cnt += 1
if i==0:
print(cnt)
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
233 ms |
29772 KB |
Output isn't correct |
2 |
Incorrect |
92 ms |
24784 KB |
Output isn't correct |
3 |
Incorrect |
76 ms |
23808 KB |
Output isn't correct |
4 |
Incorrect |
150 ms |
26772 KB |
Output isn't correct |
5 |
Incorrect |
56 ms |
20304 KB |
Output isn't correct |
6 |
Incorrect |
231 ms |
29024 KB |
Output isn't correct |
7 |
Incorrect |
76 ms |
23804 KB |
Output isn't correct |
8 |
Incorrect |
87 ms |
24616 KB |
Output isn't correct |
9 |
Incorrect |
67 ms |
21068 KB |
Output isn't correct |
10 |
Incorrect |
144 ms |
28632 KB |
Output isn't correct |
11 |
Incorrect |
161 ms |
28492 KB |
Output isn't correct |
12 |
Incorrect |
47 ms |
18808 KB |
Output isn't correct |
13 |
Incorrect |
101 ms |
22600 KB |
Output isn't correct |
14 |
Incorrect |
175 ms |
26500 KB |
Output isn't correct |
15 |
Incorrect |
87 ms |
23468 KB |
Output isn't correct |
16 |
Incorrect |
93 ms |
24736 KB |
Output isn't correct |
17 |
Incorrect |
241 ms |
30008 KB |
Output isn't correct |
18 |
Incorrect |
147 ms |
26648 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
49 ms |
20000 KB |
Output isn't correct |
2 |
Incorrect |
60 ms |
29884 KB |
Output isn't correct |
3 |
Incorrect |
55 ms |
26024 KB |
Output isn't correct |
4 |
Incorrect |
48 ms |
19164 KB |
Output isn't correct |
5 |
Incorrect |
51 ms |
25376 KB |
Output isn't correct |
6 |
Incorrect |
45 ms |
19276 KB |
Output isn't correct |
7 |
Incorrect |
46 ms |
19980 KB |
Output isn't correct |
8 |
Incorrect |
44 ms |
18932 KB |
Output isn't correct |
9 |
Incorrect |
52 ms |
26024 KB |
Output isn't correct |
10 |
Incorrect |
62 ms |
26064 KB |
Output isn't correct |
11 |
Incorrect |
55 ms |
23720 KB |
Output isn't correct |
12 |
Incorrect |
51 ms |
19480 KB |
Output isn't correct |
13 |
Incorrect |
45 ms |
19404 KB |
Output isn't correct |
14 |
Incorrect |
45 ms |
19232 KB |
Output isn't correct |
15 |
Incorrect |
50 ms |
24256 KB |
Output isn't correct |
16 |
Incorrect |
62 ms |
29940 KB |
Output isn't correct |
17 |
Incorrect |
59 ms |
20028 KB |
Output isn't correct |
18 |
Incorrect |
67 ms |
29856 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1087 ms |
26752 KB |
Time limit exceeded |
2 |
Execution timed out |
1054 ms |
26208 KB |
Time limit exceeded |
3 |
Execution timed out |
1079 ms |
27432 KB |
Time limit exceeded |
4 |
Execution timed out |
1055 ms |
28996 KB |
Time limit exceeded |
5 |
Execution timed out |
1083 ms |
31040 KB |
Time limit exceeded |
6 |
Execution timed out |
1081 ms |
29104 KB |
Time limit exceeded |
7 |
Execution timed out |
1087 ms |
30884 KB |
Time limit exceeded |
8 |
Execution timed out |
1080 ms |
26808 KB |
Time limit exceeded |
9 |
Execution timed out |
1090 ms |
26888 KB |
Time limit exceeded |
10 |
Execution timed out |
1086 ms |
27804 KB |
Time limit exceeded |
11 |
Execution timed out |
1083 ms |
28312 KB |
Time limit exceeded |
12 |
Execution timed out |
1077 ms |
28340 KB |
Time limit exceeded |
13 |
Execution timed out |
1097 ms |
28836 KB |
Time limit exceeded |
14 |
Execution timed out |
1090 ms |
37756 KB |
Time limit exceeded |
15 |
Execution timed out |
1085 ms |
28392 KB |
Time limit exceeded |
16 |
Execution timed out |
1090 ms |
27836 KB |
Time limit exceeded |
17 |
Execution timed out |
1087 ms |
25988 KB |
Time limit exceeded |
18 |
Execution timed out |
1092 ms |
26192 KB |
Time limit exceeded |
19 |
Execution timed out |
1095 ms |
27212 KB |
Time limit exceeded |
20 |
Execution timed out |
1070 ms |
27516 KB |
Time limit exceeded |
21 |
Execution timed out |
1094 ms |
34704 KB |
Time limit exceeded |
22 |
Execution timed out |
1080 ms |
30788 KB |
Time limit exceeded |
23 |
Execution timed out |
1089 ms |
29740 KB |
Time limit exceeded |
24 |
Execution timed out |
1091 ms |
30368 KB |
Time limit exceeded |
25 |
Execution timed out |
1091 ms |
28544 KB |
Time limit exceeded |
26 |
Execution timed out |
1082 ms |
28804 KB |
Time limit exceeded |
27 |
Execution timed out |
1087 ms |
30576 KB |
Time limit exceeded |
28 |
Execution timed out |
1092 ms |
29920 KB |
Time limit exceeded |
29 |
Execution timed out |
1070 ms |
30812 KB |
Time limit exceeded |
30 |
Execution timed out |
1053 ms |
29428 KB |
Time limit exceeded |
31 |
Execution timed out |
1098 ms |
28200 KB |
Time limit exceeded |
32 |
Execution timed out |
1069 ms |
28760 KB |
Time limit exceeded |
33 |
Execution timed out |
1076 ms |
29760 KB |
Time limit exceeded |
34 |
Execution timed out |
1086 ms |
30960 KB |
Time limit exceeded |
35 |
Execution timed out |
1088 ms |
29052 KB |
Time limit exceeded |
36 |
Execution timed out |
1050 ms |
31844 KB |
Time limit exceeded |
37 |
Execution timed out |
1081 ms |
30972 KB |
Time limit exceeded |
38 |
Execution timed out |
1096 ms |
29088 KB |
Time limit exceeded |
39 |
Execution timed out |
1089 ms |
28804 KB |
Time limit exceeded |
40 |
Execution timed out |
1083 ms |
28048 KB |
Time limit exceeded |
41 |
Execution timed out |
1088 ms |
31004 KB |
Time limit exceeded |
42 |
Execution timed out |
1041 ms |
29076 KB |
Time limit exceeded |