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.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
623
|
AIM Tech Round (Div. 1) |
FINISHED |
False |
7200 |
277217699 |
Feb. 4, 2016, 5:05 p.m. |
Problems
B'You are given array ai of length n. You may consecutively apply two operations to this array: Please note that each of operations may be applied at most once (and may be not applied at all) so you can remove only one segment and each number may be changed (increased or decreased) by at most 1. Also note, that you are not allowed to delete the whole array. Your goal is to calculate the minimum number of coins that you need to spend in order to make the greatest common divisor of the elements of the resulting array be greater than 1. The first line of the input contains integers n, a and b (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x891 xe2 x80 x89000 xe2 x80 x89000, xe2 x80 x890 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89a, xe2 x80 x89b xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89109) -- the length of the array, the cost of removing a single element in the first operation and the cost of changing an element, respectively. The second line contains n integers ai (2 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ai xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89109) -- elements of the array. Print a single number -- the minimum cost of changes needed to obtain an array, such that the greatest common divisor of all its elements is greater than 1. In the first sample the optimal way is to remove number 3 and pay 1 coin for it. In the second sample you need to remove a segment [17, xe2 x80 x8913] and then decrease number 6. The cost of these changes is equal to 2 xc2 xb73 xe2 x80 x89+ xe2 x80 x892 xe2 x80 x89= xe2 x80 x898 coins.'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
43746680 |
Svenny |
B |
Oct. 3, 2018, 9:33 p.m. |
OK |
D |
TESTS |
83 |
2994 |
78950400 |
|
2400 |
15808750 |
zhaoxinyi |
B |
Feb. 4, 2016, 6:49 p.m. |
OK |
FPC |
TESTS |
83 |
1013 |
24064000 |
|
2400 |
15817204 |
quangminhhlrv |
B |
Feb. 5, 2016, 2:47 a.m. |
OK |
FPC |
TESTS |
83 |
1107 |
24064000 |
|
2400 |
22455866 |
rainboy |
B |
Nov. 23, 2016, 10:44 p.m. |
OK |
GNU C |
TESTS |
83 |
483 |
7987200 |
|
2400 |
38237147 |
Sina_Imani |
B |
May 14, 2018, 3:56 p.m. |
OK |
GNU C |
TESTS |
83 |
530 |
11366400 |
|
2400 |
24627761 |
huanghc |
B |
Feb. 13, 2017, 12:40 p.m. |
OK |
GNU C++ |
TESTS |
83 |
249 |
34099200 |
|
2400 |
41385460 |
Scut82 |
B |
Aug. 9, 2018, 5:32 a.m. |
OK |
GNU C++ |
TESTS |
83 |
327 |
8806400 |
|
2400 |
15895805 |
xuruifan |
B |
Feb. 8, 2016, 12:55 p.m. |
OK |
GNU C++ |
TESTS |
83 |
327 |
27955200 |
|
2400 |
15799907 |
LayCurse |
B |
Feb. 4, 2016, 5:36 p.m. |
OK |
GNU C++ |
TESTS |
83 |
327 |
45056000 |
|
2400 |
29041676 |
vjudge5 |
B |
July 31, 2017, 8:11 a.m. |
OK |
GNU C++ |
TESTS |
83 |
343 |
6144000 |
|
2400 |
16428829 |
_Eren_ |
B |
Feb. 29, 2016, 3:54 p.m. |
OK |
GNU C++ |
TESTS |
83 |
358 |
7987200 |
|
2400 |
15817158 |
ShineRain |
B |
Feb. 5, 2016, 2:42 a.m. |
OK |
GNU C++ |
TESTS |
83 |
358 |
7987200 |
|
2400 |
20190210 |
vjudge5 |
B |
Aug. 27, 2016, 7:39 a.m. |
OK |
GNU C++ |
TESTS |
83 |
358 |
15462400 |
|
2400 |
18178844 |
zhangchen |
B |
June 1, 2016, 7:57 a.m. |
OK |
GNU C++ |
TESTS |
83 |
373 |
18124800 |
|
2400 |
15806465 |
dohyun0324 |
B |
Feb. 4, 2016, 6:26 p.m. |
OK |
GNU C++ |
TESTS |
83 |
389 |
15974400 |
|
2400 |
15809062 |
ExfJoe |
B |
Feb. 4, 2016, 6:53 p.m. |
OK |
GNU C++11 |
TESTS |
83 |
296 |
20070400 |
|
2400 |
15842668 |
_0w0_ |
B |
Feb. 6, 2016, 1:02 p.m. |
OK |
GNU C++11 |
TESTS |
83 |
312 |
13107200 |
|
2400 |
40985229 |
ReaLNero1 |
B |
July 30, 2018, 7:49 p.m. |
OK |
GNU C++11 |
TESTS |
83 |
312 |
20070400 |
|
2400 |
15806765 |
niquefa_diego |
B |
Feb. 4, 2016, 6:29 p.m. |
OK |
GNU C++11 |
TESTS |
83 |
312 |
44134400 |
|
2400 |
15812054 |
forifchen |
B |
Feb. 4, 2016, 7:51 p.m. |
OK |
GNU C++11 |
TESTS |
83 |
343 |
20070400 |
|
2400 |
15816757 |
EEEEEericKKK |
B |
Feb. 5, 2016, 1:59 a.m. |
OK |
GNU C++11 |
TESTS |
83 |
343 |
28057600 |
|
2400 |
23350221 |
spetsnaz |
B |
Dec. 27, 2016, 12:32 a.m. |
OK |
GNU C++11 |
TESTS |
83 |
358 |
10035200 |
|
2400 |
15895732 |
xuruifan |
B |
Feb. 8, 2016, 12:51 p.m. |
OK |
GNU C++11 |
TESTS |
83 |
358 |
27955200 |
|
2400 |
17534024 |
PPFish |
B |
April 27, 2016, 11:09 a.m. |
OK |
GNU C++11 |
TESTS |
83 |
373 |
30310400 |
|
2400 |
15805086 |
ComradePetr |
B |
Feb. 4, 2016, 6:14 p.m. |
OK |
GNU C++11 |
TESTS |
83 |
389 |
13004800 |
|
2400 |
45590360 |
Hamzqq9 |
B |
Nov. 12, 2018, 12:01 p.m. |
OK |
GNU C++14 |
TESTS |
83 |
436 |
20070400 |
|
2400 |
45590302 |
Hamzqq9 |
B |
Nov. 12, 2018, 11:59 a.m. |
OK |
GNU C++14 |
TESTS |
83 |
452 |
20070400 |
|
2400 |
54545026 |
GLAYS |
B |
May 24, 2019, 5:36 a.m. |
OK |
GNU C++14 |
TESTS |
83 |
483 |
20480000 |
|
2400 |
30485862 |
TiChuot97 |
B |
Sept. 19, 2017, 12:01 a.m. |
OK |
GNU C++14 |
TESTS |
83 |
499 |
28160000 |
|
2400 |
33377671 |
cyz666 |
B |
Dec. 18, 2017, 11:54 a.m. |
OK |
GNU C++14 |
TESTS |
83 |
514 |
5939200 |
|
2400 |
45394329 |
I_love_Y_UME |
B |
Nov. 7, 2018, 2:22 a.m. |
OK |
GNU C++14 |
TESTS |
83 |
530 |
32563200 |
|
2400 |
39227065 |
Dalgerok |
B |
June 13, 2018, 9:19 p.m. |
OK |
GNU C++14 |
TESTS |
83 |
561 |
28057600 |
|
2400 |
56517617 |
misael |
B |
July 4, 2019, 1:28 p.m. |
OK |
GNU C++14 |
TESTS |
83 |
576 |
12185600 |
|
2400 |
30191601 |
apoorv_kulsh |
B |
Sept. 7, 2017, 10:22 p.m. |
OK |
GNU C++14 |
TESTS |
83 |
576 |
12185600 |
|
2400 |
23342186 |
Iskalibur |
B |
Dec. 26, 2016, 2:35 p.m. |
OK |
GNU C++14 |
TESTS |
83 |
577 |
34304000 |
|
2400 |
55529079 |
ArshiaDadras |
B |
June 13, 2019, 12:38 p.m. |
OK |
GNU C++17 |
TESTS |
83 |
452 |
12083200 |
|
2400 |
51892004 |
Juve45 |
B |
March 27, 2019, 9:38 a.m. |
OK |
GNU C++17 |
TESTS |
83 |
499 |
28057600 |
|
2400 |
53464237 |
pit4h |
B |
April 28, 2019, 9:06 a.m. |
OK |
GNU C++17 |
TESTS |
83 |
529 |
36044800 |
|
2400 |
49349312 |
vjudge3 |
B |
Feb. 2, 2019, 7:28 a.m. |
OK |
GNU C++17 |
TESTS |
83 |
530 |
8294400 |
|
2400 |
68097525 |
Arianfk |
B |
Jan. 2, 2020, 10:08 p.m. |
OK |
GNU C++17 |
TESTS |
83 |
545 |
11980800 |
|
2400 |
46549484 |
kefaa2 |
B |
Dec. 3, 2018, 4:56 p.m. |
OK |
GNU C++17 |
TESTS |
83 |
545 |
36044800 |
|
2400 |
49392226 |
Atreus |
B |
Feb. 3, 2019, 10:35 a.m. |
OK |
GNU C++17 |
TESTS |
83 |
560 |
10240000 |
|
2400 |
57720710 |
neckborov |
B |
July 25, 2019, 5:11 a.m. |
OK |
GNU C++17 |
TESTS |
83 |
561 |
4198400 |
|
2400 |
63620850 |
ivan100sic |
B |
Oct. 27, 2019, 10:50 p.m. |
OK |
GNU C++17 |
TESTS |
83 |
576 |
12288000 |
|
2400 |
58512244 |
AryssonFigueiredo |
B |
Aug. 9, 2019, 7:46 p.m. |
OK |
GNU C++17 |
TESTS |
83 |
592 |
20377600 |
|
2400 |
15825030 |
fromWork |
B |
Feb. 5, 2016, 12:42 p.m. |
OK |
Java 7 |
TESTS |
83 |
1279 |
125337600 |
|
2400 |
15854039 |
minsu |
B |
Feb. 7, 2016, 8:36 a.m. |
OK |
Java 7 |
TESTS |
83 |
2713 |
188825600 |
|
2400 |
15842121 |
mkirsche |
B |
Feb. 6, 2016, 12:24 p.m. |
OK |
Java 7 |
TESTS |
83 |
2714 |
186470400 |
|
2400 |
15824729 |
mbrc |
B |
Feb. 5, 2016, 12:26 p.m. |
OK |
Java 7 |
TESTS |
83 |
2776 |
108032000 |
|
2400 |
15830238 |
minsu |
B |
Feb. 5, 2016, 5:28 p.m. |
OK |
Java 7 |
TESTS |
83 |
2839 |
188825600 |
|
2400 |
15817334 |
nitegazer |
B |
Feb. 5, 2016, 3 a.m. |
OK |
Java 7 |
TESTS |
83 |
2978 |
187392000 |
|
2400 |
15798743 |
Egor |
B |
Feb. 4, 2016, 5:30 p.m. |
OK |
Java 8 |
TESTS |
83 |
561 |
7475200 |
|
2400 |
15811108 |
uwi |
B |
Feb. 4, 2016, 7:33 p.m. |
OK |
Java 8 |
TESTS |
83 |
701 |
20787200 |
|
2400 |
50797270 |
hongquanntct |
B |
March 4, 2019, 7:27 p.m. |
OK |
Java 8 |
TESTS |
83 |
717 |
87040000 |
|
2400 |
22413102 |
Dukkha |
B |
Nov. 22, 2016, 9:34 p.m. |
OK |
Java 8 |
TESTS |
83 |
888 |
69939200 |
|
2400 |
15812898 |
arechitsky |
B |
Feb. 4, 2016, 8:16 p.m. |
OK |
Java 8 |
TESTS |
83 |
889 |
91648000 |
|
2400 |
44719175 |
xodiac |
B |
Oct. 23, 2018, 2:26 a.m. |
OK |
Java 8 |
TESTS |
83 |
920 |
67481600 |
|
2400 |
17318155 |
sandun |
B |
April 14, 2016, 5:41 p.m. |
OK |
Java 8 |
TESTS |
83 |
920 |
97792000 |
|
2400 |
17318317 |
sandun |
B |
April 14, 2016, 5:54 p.m. |
OK |
Java 8 |
TESTS |
83 |
966 |
97792000 |
|
2400 |
17318264 |
sandun |
B |
April 14, 2016, 5:50 p.m. |
OK |
Java 8 |
TESTS |
83 |
982 |
97792000 |
|
2400 |
24477914 |
safarisoul |
B |
Feb. 6, 2017, 11:12 p.m. |
OK |
Java 8 |
TESTS |
83 |
1029 |
108441600 |
|
2400 |
15812319 |
og.kostya |
B |
Feb. 4, 2016, 7:57 p.m. |
OK |
MS C# |
TESTS |
83 |
327 |
14438400 |
|
2400 |
15828015 |
AnatolyTolstobrov |
B |
Feb. 5, 2016, 3:12 p.m. |
OK |
MS C# |
TESTS |
83 |
343 |
6656000 |
|
2400 |
15827716 |
AnatolyTolstobrov |
B |
Feb. 5, 2016, 2:56 p.m. |
OK |
MS C# |
TESTS |
83 |
343 |
6656000 |
|
2400 |
15827944 |
AnatolyTolstobrov |
B |
Feb. 5, 2016, 3:08 p.m. |
OK |
MS C# |
TESTS |
83 |
436 |
6656000 |
|
2400 |
15827903 |
AnatolyTolstobrov |
B |
Feb. 5, 2016, 3:06 p.m. |
OK |
MS C# |
TESTS |
83 |
452 |
6656000 |
|
2400 |
15818857 |
og.kostya |
B |
Feb. 5, 2016, 5:36 a.m. |
OK |
MS C# |
TESTS |
83 |
452 |
14438400 |
|
2400 |
15806713 |
azukun |
B |
Feb. 4, 2016, 6:28 p.m. |
OK |
MS C# |
TESTS |
83 |
733 |
127590400 |
|
2400 |
15806704 |
AnnKats93 |
B |
Feb. 4, 2016, 6:28 p.m. |
OK |
MS C++ |
TESTS |
83 |
499 |
3993600 |
|
2400 |
15811553 |
AleksanderBalobanov |
B |
Feb. 4, 2016, 7:40 p.m. |
OK |
MS C++ |
TESTS |
83 |
514 |
20070400 |
|
2400 |
15827070 |
liuyuhong |
B |
Feb. 5, 2016, 2:22 p.m. |
OK |
MS C++ |
TESTS |
83 |
546 |
20070400 |
|
2400 |
15822351 |
Taube |
B |
Feb. 5, 2016, 9:38 a.m. |
OK |
MS C++ |
TESTS |
83 |
546 |
28057600 |
|
2400 |
15813407 |
Death_Knight_DK |
B |
Feb. 4, 2016, 8:38 p.m. |
OK |
MS C++ |
TESTS |
83 |
546 |
28876800 |
|
2400 |
15811619 |
AleksanderBalobanov |
B |
Feb. 4, 2016, 7:41 p.m. |
OK |
MS C++ |
TESTS |
83 |
561 |
20070400 |
|
2400 |
15839903 |
sand-martin |
B |
Feb. 6, 2016, 9:43 a.m. |
OK |
MS C++ |
TESTS |
83 |
592 |
28057600 |
|
2400 |
15827225 |
liuyuhong |
B |
Feb. 5, 2016, 2:29 p.m. |
OK |
MS C++ |
TESTS |
83 |
608 |
28057600 |
|
2400 |
15835382 |
Ancient_mage |
B |
Feb. 6, 2016, 1:07 a.m. |
OK |
MS C++ |
TESTS |
83 |
623 |
53043200 |
|
2400 |
15811921 |
Milanin |
B |
Feb. 4, 2016, 7:47 p.m. |
OK |
MS C++ |
TESTS |
83 |
624 |
20070400 |
|
2400 |
remove filters
Back to search problems