Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
B'Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1. Arpa can perform two types of operations: Arpa can apply these operations to as many numbers as he wishes, and he is allowed to apply the second operation arbitrarily many times on the same number. Help Arpa to find the minimum possible cost to make the list good. First line contains three integers n, x and y (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x895 xc2 xb7105, 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89x, xe2 x80 x89y xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89109) -- the number of elements in the list and the integers x and y. Second line contains n integers a1, xe2 x80 x89a2, xe2 x80 x89..., xe2 x80 x89an (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ai xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89106) -- the elements of the list. Print a single integer: the minimum possible cost to make the list good. In example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17). A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
30196672 |
fluffyowl |
B |
Sept. 8, 2017, 7:02 a.m. |
OK |
D |
TESTS |
153 |
764 |
62873600 |
|
2000 |
32061514 |
ruban |
B |
Nov. 4, 2017, 6:58 p.m. |
OK |
Delphi |
TESTS |
153 |
389 |
66150400 |
|
2000 |
30473652 |
huw |
B |
Sept. 18, 2017, 3:13 p.m. |
OK |
FPC |
TESTS |
153 |
249 |
43724800 |
|
2000 |
30364247 |
dinhquyduc13021 |
B |
Sept. 15, 2017, 1:38 p.m. |
OK |
FPC |
TESTS |
153 |
296 |
42086400 |
|
2000 |
33861890 |
AsahiKasugano |
B |
Jan. 2, 2018, 10:49 a.m. |
OK |
FPC |
TESTS |
153 |
951 |
33792000 |
|
2000 |
33861804 |
KagamiharaNadeshiko |
B |
Jan. 2, 2018, 10:43 a.m. |
OK |
FPC |
TESTS |
153 |
966 |
33792000 |
|
2000 |
30358431 |
Faimerth |
B |
Sept. 15, 2017, 7:05 a.m. |
OK |
GNU C |
TESTS |
153 |
202 |
60211200 |
|
2000 |
30089743 |
ojtrans2 |
B |
Sept. 5, 2017, 3:50 a.m. |
OK |
GNU C++ |
TESTS |
153 |
78 |
11980800 |
|
2000 |
30088913 |
faebdc |
B |
Sept. 5, 2017, 2:49 a.m. |
OK |
GNU C++ |
TESTS |
153 |
140 |
21196800 |
|
2000 |
36786166 |
vjudge2 |
B |
April 1, 2018, 1:32 a.m. |
OK |
GNU C++ |
TESTS |
153 |
187 |
10444800 |
|
2000 |
30071907 |
phoenix71 |
B |
Sept. 4, 2017, 3:57 p.m. |
OK |
GNU C++ |
TESTS |
153 |
187 |
21094400 |
|
2000 |
30491450 |
vjudge2 |
B |
Sept. 19, 2017, 8:24 a.m. |
OK |
GNU C++ |
TESTS |
153 |
202 |
36556800 |
|
2000 |
32075632 |
lllllllllllllllllllllll |
B |
Nov. 5, 2017, 12:08 p.m. |
OK |
GNU C++ |
TESTS |
153 |
217 |
32051200 |
|
2000 |
30089646 |
guille |
B |
Sept. 5, 2017, 3:43 a.m. |
OK |
GNU C++ |
TESTS |
153 |
218 |
20070400 |
|
2000 |
30085952 |
nwi |
B |
Sept. 4, 2017, 10:35 p.m. |
OK |
GNU C++ |
TESTS |
153 |
218 |
31846400 |
|
2000 |
36786128 |
vjudge1 |
B |
April 1, 2018, 1:25 a.m. |
OK |
GNU C++ |
TESTS |
153 |
218 |
53452800 |
|
2000 |
30097955 |
bakabakashyoshyo |
B |
Sept. 5, 2017, 11:30 a.m. |
OK |
GNU C++ |
TESTS |
153 |
233 |
23859200 |
|
2000 |
40979998 |
ReaLNero1 |
B |
July 30, 2018, 5:19 p.m. |
OK |
GNU C++11 |
TESTS |
153 |
93 |
12083200 |
|
2000 |
30083995 |
MrDindows |
B |
Sept. 4, 2017, 8:09 p.m. |
OK |
GNU C++11 |
TESTS |
153 |
108 |
33280000 |
|
2000 |
50931534 |
Gloid |
B |
March 7, 2019, 2:10 p.m. |
OK |
GNU C++11 |
TESTS |
153 |
109 |
17100800 |
|
2000 |
50918803 |
Gloid |
B |
March 7, 2019, 7:59 a.m. |
OK |
GNU C++11 |
TESTS |
153 |
140 |
17100800 |
|
2000 |
30083796 |
MrDindows |
B |
Sept. 4, 2017, 7:59 p.m. |
OK |
GNU C++11 |
TESTS |
153 |
140 |
33280000 |
|
2000 |
30083850 |
MrDindows |
B |
Sept. 4, 2017, 8:02 p.m. |
OK |
GNU C++11 |
TESTS |
153 |
155 |
33280000 |
|
2000 |
30319475 |
Georeth |
B |
Sept. 14, 2017, 3:19 a.m. |
OK |
GNU C++11 |
TESTS |
153 |
171 |
33075200 |
|
2000 |
30196158 |
tangtangtang |
B |
Sept. 8, 2017, 6:30 a.m. |
OK |
GNU C++11 |
TESTS |
153 |
186 |
24064000 |
|
2000 |
68611105 |
vjudge1 |
B |
Jan. 11, 2020, 3:44 p.m. |
OK |
GNU C++11 |
TESTS |
153 |
187 |
34099200 |
|
2000 |
30076975 |
jvjhfhg |
B |
Sept. 4, 2017, 4:37 p.m. |
OK |
GNU C++11 |
TESTS |
153 |
202 |
11059200 |
|
2000 |
30083993 |
MrDindows |
B |
Sept. 4, 2017, 8:09 p.m. |
OK |
GNU C++14 |
TESTS |
153 |
109 |
33280000 |
|
2000 |
30083915 |
MrDindows |
B |
Sept. 4, 2017, 8:05 p.m. |
OK |
GNU C++14 |
TESTS |
153 |
109 |
33280000 |
|
2000 |
30083875 |
MrDindows |
B |
Sept. 4, 2017, 8:03 p.m. |
OK |
GNU C++14 |
TESTS |
153 |
109 |
33280000 |
|
2000 |
30083854 |
MrDindows |
B |
Sept. 4, 2017, 8:02 p.m. |
OK |
GNU C++14 |
TESTS |
153 |
124 |
33280000 |
|
2000 |
30083793 |
MrDindows |
B |
Sept. 4, 2017, 7:59 p.m. |
OK |
GNU C++14 |
TESTS |
153 |
124 |
33280000 |
|
2000 |
30083645 |
MrDindows |
B |
Sept. 4, 2017, 7:53 p.m. |
OK |
GNU C++14 |
TESTS |
153 |
124 |
33280000 |
|
2000 |
30083601 |
MrDindows |
B |
Sept. 4, 2017, 7:51 p.m. |
OK |
GNU C++14 |
TESTS |
153 |
187 |
33280000 |
|
2000 |
30129187 |
The_Unbeatable |
B |
Sept. 6, 2017, 10:54 a.m. |
OK |
GNU C++14 |
TESTS |
153 |
202 |
25497600 |
|
2000 |
30079073 |
roman.kolganov |
B |
Sept. 4, 2017, 4:55 p.m. |
OK |
GNU C++14 |
TESTS |
153 |
218 |
6144000 |
|
2000 |
30098637 |
misael |
B |
Sept. 5, 2017, 12:07 p.m. |
OK |
GNU C++14 |
TESTS |
153 |
218 |
10035200 |
|
2000 |
52466948 |
Vanishment |
B |
April 7, 2019, 4:13 p.m. |
OK |
GNU C++17 |
TESTS |
153 |
171 |
12083200 |
|
2000 |
58010961 |
KasugaAyumu |
B |
July 30, 2019, 3:20 p.m. |
OK |
GNU C++17 |
TESTS |
153 |
202 |
18636800 |
|
2000 |
60469234 |
Tunder__Sun |
B |
Sept. 13, 2019, 4:19 a.m. |
OK |
GNU C++17 |
TESTS |
153 |
218 |
33996800 |
|
2000 |
41248449 |
crathva |
B |
Aug. 5, 2018, 2:32 p.m. |
OK |
GNU C++17 |
TESTS |
153 |
233 |
11366400 |
|
2000 |
59919445 |
mohmahkho |
B |
Sept. 2, 2019, 9:20 p.m. |
OK |
GNU C++17 |
TESTS |
153 |
249 |
14028800 |
|
2000 |
69660629 |
Amber30 |
B |
Jan. 28, 2020, 9:15 a.m. |
OK |
GNU C++17 |
TESTS |
153 |
264 |
24064000 |
|
2000 |
54860573 |
AliShahali1382 |
B |
May 31, 2019, 1:10 a.m. |
OK |
GNU C++17 |
TESTS |
153 |
265 |
40243200 |
|
2000 |
68114178 |
Arianfk |
B |
Jan. 3, 2020, 10:47 a.m. |
OK |
GNU C++17 |
TESTS |
153 |
280 |
29081600 |
|
2000 |
69232022 |
Utkarsh.25dec |
B |
Jan. 21, 2020, 9:52 a.m. |
OK |
GNU C++17 |
TESTS |
153 |
295 |
43417600 |
|
2000 |
36794628 |
vjudge2 |
B |
April 1, 2018, 9:56 a.m. |
OK |
GNU C++17 |
TESTS |
153 |
296 |
29388800 |
|
2000 |
30562697 |
mishagam |
B |
Sept. 20, 2017, 10:28 p.m. |
OK |
Go |
TESTS |
153 |
218 |
44851200 |
|
2000 |
30565399 |
chojh1222 |
B |
Sept. 21, 2017, 1:50 a.m. |
OK |
Java 8 |
TESTS |
153 |
389 |
23756800 |
|
2000 |
30263272 |
Kroma |
B |
Sept. 11, 2017, 10:06 a.m. |
OK |
Java 8 |
TESTS |
153 |
404 |
78950400 |
|
2000 |
68102027 |
yaoct |
B |
Jan. 3, 2020, 4:07 a.m. |
OK |
Java 8 |
TESTS |
153 |
405 |
75571200 |
|
2000 |
30081759 |
mmaxio |
B |
Sept. 4, 2017, 6:51 p.m. |
OK |
Java 8 |
TESTS |
153 |
420 |
36966400 |
|
2000 |
30084521 |
ebaalhuis |
B |
Sept. 4, 2017, 8:35 p.m. |
OK |
Java 8 |
TESTS |
153 |
420 |
40038400 |
|
2000 |
30066382 |
tbuzzelli |
B |
Sept. 4, 2017, 3:22 p.m. |
OK |
Java 8 |
TESTS |
153 |
451 |
35430400 |
|
2000 |
30199944 |
CrazyBBB |
B |
Sept. 8, 2017, 10:28 a.m. |
OK |
Java 8 |
TESTS |
153 |
545 |
52736000 |
|
2000 |
30337834 |
kubusgol |
B |
Sept. 14, 2017, 8:02 p.m. |
OK |
Java 8 |
TESTS |
153 |
576 |
53350400 |
|
2000 |
30203232 |
CrazyBBB |
B |
Sept. 8, 2017, 1:25 p.m. |
OK |
Java 8 |
TESTS |
153 |
577 |
52736000 |
|
2000 |
38701425 |
Darth_Jar_Jar_Binks |
B |
May 28, 2018, 5:57 p.m. |
OK |
Java 8 |
TESTS |
153 |
733 |
62566400 |
|
2000 |
30187800 |
Samyrai |
B |
Sept. 7, 2017, 5:52 p.m. |
OK |
MS C# |
TESTS |
153 |
1169 |
58982400 |
|
2000 |
30116170 |
natalia |
B |
Sept. 5, 2017, 6:26 p.m. |
OK |
MS C++ |
TESTS |
153 |
389 |
50278400 |
|
2000 |
30072776 |
AleksanderBalobanov |
B |
Sept. 4, 2017, 4:03 p.m. |
OK |
MS C++ |
TESTS |
153 |
421 |
85708800 |
|
2000 |
69806926 |
Gleb_Dubosarskii |
B |
Jan. 30, 2020, 2:24 a.m. |
OK |
MS C++ |
TESTS |
153 |
1606 |
48025600 |
|
2000 |
69807058 |
Gleb_Dubosarskii |
B |
Jan. 30, 2020, 2:28 a.m. |
OK |
MS C++ |
TESTS |
153 |
1653 |
48025600 |
|
2000 |
remove filters
Back to search problems