Codeforces Round 481 (Div. 3)

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
978 Codeforces Round 481 (Div. 3) FINISHED False 9000 210977663 May 13, 2018, 9:05 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 8971 ) D Almost Arithmetic Progression PROGRAMMING brute force implementation math 1500

B"Polycarp likes arithmetic progressions. A sequence [a_1, a_2, ... , a_n] is called an arithmetic progression if for each i ( 1 <= i < n ) the value a_{i+1} - a_i is the same. For example, the sequences [42] , [5, 5, 5] , [2, 11, 20, 29] and [3, 2, 1, 0] are arithmetic progressions, but [1, 0, 1] , [1, 3, 9] and [2, 3, 1] are not. It follows from the definition that any sequence of length one or two is an arithmetic progression. Polycarp found some sequence of positive integers [b_1, b_2, ... , b_n] . He agrees to change each element by at most one. In the other words, for each element there are exactly three options: an element can be decreased by 1 , an element can be increased by 1 , an element can be left unchanged. Determine a minimum possible number of elements in b which can be changed (by exactly one), so that the sequence b becomes an arithmetic progression, or report that it is impossible. It is possible that the resulting sequence contains element equals 0 . The first line contains a single integer n (1 <= n <= 100 ,000) -- the number of elements in b . The second line contains a sequence b_1, b_2, ... , b_n (1 <= b_i <= 10^{9}) . If it is impossible to make an arithmetic progression with described operations, print -1. In the other case, print non-negative integer -- the minimum number of elements to change to make the given sequence becomes an arithmetic progression. The only allowed operation is to add/to subtract one from an element (can't use operation twice to the same position). In the first example Polycarp should increase the first number on 1 , decrease the second number on 1 , increase the third number on 1 , and the fourth number should left unchanged. So, after Polycarp changed three elements by one, his sequence became equals to [25, 20, 15, 10] , which is an arithmetic progression. I"...

Tutorials

T

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
40084696 chaorenhaha D July 8, 2018, 12:10 p.m. OK FPC TESTS 39 46 7987200 1500
38882373 C1ariS D June 2, 2018, 10:01 a.m. OK GNU C TESTS 39 31 11366400 1500
38951163 xiao-xiao D June 4, 2018, 5:03 p.m. OK GNU C TESTS 39 46 3686400 1500
38951092 xiao-xiao D June 4, 2018, 5 p.m. OK GNU C TESTS 39 46 3686400 1500
42322071 ntschdngsprblm D Aug. 31, 2018, 11:01 p.m. OK GNU C TESTS 39 61 819200 1500
38717638 vjudge2 D May 29, 2018, 11:58 a.m. OK GNU C++ TESTS 39 31 204800 1500
41902939 Blue_Fly D Aug. 20, 2018, 1:08 p.m. OK GNU C++ TESTS 39 31 409600 1500
39185808 vjudge5 D June 12, 2018, 9:02 a.m. OK GNU C++ TESTS 39 31 409600 1500
39459079 .counter D June 21, 2018, 10:44 a.m. OK GNU C++ TESTS 39 31 409600 1500
41902928 vjudge2 D Aug. 20, 2018, 1:08 p.m. OK GNU C++ TESTS 39 31 409600 1500
41589919 jangjie D Aug. 14, 2018, 1:32 p.m. OK GNU C++ TESTS 39 31 614400 1500
40882900 yohan5050 cyblack D July 28, 2018, 11:32 a.m. OK GNU C++ TESTS 39 31 614400 1500
38650728 vjudge5 D May 27, 2018, 8:16 a.m. OK GNU C++ TESTS 39 31 614400 1500
38587790 vjudge1 D May 24, 2018, 1:21 p.m. OK GNU C++ TESTS 39 31 614400 1500
38587721 vjudge2 D May 24, 2018, 1:18 p.m. OK GNU C++ TESTS 39 31 614400 1500
47026358 vjudge4 D Dec. 15, 2018, 7:10 a.m. OK GNU C11 TESTS 39 46 409600 1500
47026340 idealthm D Dec. 15, 2018, 7:09 a.m. OK GNU C11 TESTS 39 46 409600 1500
46938849 tube-lite D Dec. 12, 2018, 3:21 p.m. OK GNU C11 TESTS 39 46 409600 1500
42079908 dalek_cos D Aug. 25, 2018, 7:43 a.m. OK GNU C11 TESTS 39 46 819200 1500
69180981 mth1908 D Jan. 20, 2020, 10:08 a.m. OK GNU C11 TESTS 39 46 819200 1500
66564543 cdza D Dec. 9, 2019, 8:54 p.m. OK GNU C11 TESTS 39 46 1638400 1500
66562798 cdza D Dec. 9, 2019, 7:48 p.m. OK GNU C11 TESTS 39 46 1638400 1500
46819213 xucanxx D Dec. 9, 2018, 2:08 p.m. OK GNU C11 TESTS 39 46 7987200 1500
39014936 A.Freeman D June 7, 2018, 9:43 a.m. OK GNU C++11 TESTS 39 30 204800 1500
39304656 ILLENIUM D June 16, 2018, 5:41 p.m. OK GNU C++11 TESTS 39 30 1638400 1500
56772867 zyn_615 D July 9, 2019, 11:58 p.m. OK GNU C++11 TESTS 39 30 2764800 1500
38621761 codercody D May 26, 2018, 3:16 a.m. OK GNU C++11 TESTS 39 31 204800 1500
41927733 qlp_123 D Aug. 21, 2018, 8:22 a.m. OK GNU C++11 TESTS 39 31 204800 1500
58395010 HazemAlkhatib D Aug. 6, 2019, 3:16 p.m. OK GNU C++11 TESTS 39 31 409600 1500
57566932 luogu_bot1 D July 23, 2019, 3:20 a.m. OK GNU C++11 TESTS 39 31 409600 1500
58228554 luogu_bot5 D Aug. 3, 2019, 3:37 p.m. OK GNU C++11 TESTS 39 31 409600 1500
58240080 luogu_bot3 D Aug. 3, 2019, 11:32 p.m. OK GNU C++11 TESTS 39 31 409600 1500
57566959 luogu_bot3 D July 23, 2019, 3:20 a.m. OK GNU C++11 TESTS 39 31 409600 1500
52324208 veronsh73 D April 4, 2019, 10:17 p.m. OK GNU C++14 TESTS 39 31 819200 1500
53563222 sliman00 D April 30, 2019, 10:56 a.m. OK GNU C++14 TESTS 39 31 819200 1500
61892275 Lovinix D Oct. 5, 2019, 6:10 a.m. OK GNU C++14 TESTS 39 46 409600 1500
69279539 Ugnwd D Jan. 22, 2020, 5:06 a.m. OK GNU C++14 TESTS 39 46 409600 1500
68361615 HassanYousef D Jan. 7, 2020, 2:18 p.m. OK GNU C++14 TESTS 39 46 409600 1500
68012927 Bondo D Dec. 31, 2019, 4:48 p.m. OK GNU C++14 TESTS 39 46 409600 1500
67942171 Peppercorn D Dec. 30, 2019, 2:14 a.m. OK GNU C++14 TESTS 39 46 409600 1500
66991488 Lutece D Dec. 15, 2019, 8:43 p.m. OK GNU C++14 TESTS 39 46 409600 1500
62110517 roferrlls D Oct. 8, 2019, 12:04 p.m. OK GNU C++14 TESTS 39 46 409600 1500
58360178 rennanrocha D Aug. 5, 2019, 11:16 p.m. OK GNU C++14 TESTS 39 46 409600 1500
57822193 vjudge3 D July 27, 2019, 12:22 a.m. OK GNU C++17 TESTS 39 31 409600 1500
67168264 LeoRiether D Dec. 18, 2019, 4:20 p.m. OK GNU C++17 TESTS 39 31 409600 1500
39345790 1378008099 D June 18, 2018, 2:25 a.m. OK GNU C++17 TESTS 39 31 819200 1500
56831419 vjudge4 D July 11, 2019, 7:11 a.m. OK GNU C++17 TESTS 39 46 0 1500
69652734 guanhuhao D Jan. 28, 2020, 6:06 a.m. OK GNU C++17 TESTS 39 46 409600 1500
69676431 nameste D Jan. 28, 2020, 2:24 p.m. OK GNU C++17 TESTS 39 46 409600 1500
68304748 vjudge5 D Jan. 6, 2020, 8:29 a.m. OK GNU C++17 TESTS 39 46 409600 1500
68233930 JonasAAA D Jan. 5, 2020, 10:13 a.m. OK GNU C++17 TESTS 39 46 409600 1500
68368215 mayank.goyal D Jan. 7, 2020, 4:45 p.m. OK GNU C++17 TESTS 39 46 409600 1500
69652723 vjudge1 D Jan. 28, 2020, 6:06 a.m. OK GNU C++17 TESTS 39 46 409600 1500
56872337 porktw D July 12, 2019, 6:56 a.m. OK Go TESTS 39 46 0 1500
42912500 Marii D Sept. 16, 2018, 8:01 a.m. OK Go TESTS 39 109 409600 1500
39883435 Psp_98 D July 3, 2018, 4:32 a.m. OK Java 8 TESTS 39 124 0 1500
69564940 luchy0120 D Jan. 26, 2020, 12:04 p.m. OK Java 8 TESTS 39 124 0 1500
59685847 Agnimandur D Aug. 30, 2019, 1:25 a.m. OK Java 8 TESTS 39 124 0 1500
56021289 caoash D June 25, 2019, 3:39 a.m. OK Java 8 TESTS 39 124 0 1500
55849523 the41 D June 21, 2019, 2:15 a.m. OK Java 8 TESTS 39 124 0 1500
52601904 viniru100 D April 11, 2019, 12:18 p.m. OK Java 8 TESTS 39 124 0 1500
47776809 rogernadal D Dec. 31, 2018, 4:45 a.m. OK Java 8 TESTS 39 124 0 1500
40253851 VerticesEdge D July 13, 2018, 7:51 a.m. OK Java 8 TESTS 39 124 0 1500
40206044 prashanth_rebala D July 11, 2018, 3:36 p.m. OK Java 8 TESTS 39 124 0 1500
69666995 its_aks_ulure D Jan. 28, 2020, 11:42 a.m. OK Java 8 TESTS 39 139 0 1500
48714973 SergeySh D Jan. 22, 2019, 10:43 a.m. OK JavaScript TESTS 39 92 14540800 1500
60492678 XinLoiNguoi D Sept. 13, 2019, 3:04 p.m. OK Kotlin TESTS 39 280 0 1500
39338507 stepanovep D June 17, 2018, 3:02 p.m. OK Kotlin TESTS 39 327 0 1500
39728205 sarim D June 27, 2018, 9:50 p.m. OK Mono C# TESTS 39 62 11161600 1500
40509226 Mosyagin D July 18, 2018, 10:05 a.m. OK Mono C# TESTS 39 77 11673600 1500
38706028 Anastasiya_Andreevna D May 28, 2018, 11:36 p.m. OK Mono C# TESTS 39 77 14131200 1500
60293550 nadilk D Sept. 9, 2019, 8:47 a.m. OK Mono C# TESTS 39 93 23859200 1500
68643593 hibatibati D Jan. 12, 2020, 8:19 a.m. OK Mono C# TESTS 39 108 15155200 1500
50429584 _SHREDDER_ D Feb. 24, 2019, 1:20 p.m. OK Mono C# TESTS 39 109 19660800 1500
38653419 vjudge2 D May 27, 2018, 10:44 a.m. OK MS C++ TESTS 39 31 409600 1500
49085916 MYSNKS D Jan. 28, 2019, 7:26 a.m. OK MS C++ TESTS 39 31 409600 1500
49936482 vjudge1 D Feb. 15, 2019, 7:31 a.m. OK MS C++ TESTS 39 31 409600 1500
55426693 vjudge1 D June 11, 2019, 9:21 a.m. OK MS C++ TESTS 39 31 409600 1500
68340397 vjudge5 D Jan. 7, 2020, 3 a.m. OK MS C++ TESTS 39 31 819200 1500
68340604 vjudge1 D Jan. 7, 2020, 3:12 a.m. OK MS C++ TESTS 39 31 819200 1500
68339921 vjudge1 D Jan. 7, 2020, 2:31 a.m. OK MS C++ TESTS 39 31 819200 1500
68304109 vjudge5 D Jan. 6, 2020, 8:13 a.m. OK MS C++ TESTS 39 31 819200 1500
55423314 vjudge1 D June 11, 2019, 7:43 a.m. OK MS C++ TESTS 39 31 819200 1500
55394189 vjudge5 D June 10, 2019, 11:05 a.m. OK MS C++ TESTS 39 31 819200 1500
58528806 Saber_Altria D Aug. 10, 2019, 8:29 a.m. OK MS C++ 2017 TESTS 39 46 819200 1500
59124232 vjudge1 D Aug. 20, 2019, 7:44 a.m. OK MS C++ 2017 TESTS 39 46 819200 1500
58528659 vjudge3 D Aug. 10, 2019, 8:25 a.m. OK MS C++ 2017 TESTS 39 46 819200 1500
51092765 NPUlzh D March 9, 2019, 2:59 p.m. OK MS C++ 2017 TESTS 39 46 819200 1500
58528794 yyoooo D Aug. 10, 2019, 8:29 a.m. OK MS C++ 2017 TESTS 39 61 7987200 1500
63223784 AleksanderBalobanov D Oct. 23, 2019, 8:41 a.m. OK MS C++ 2017 TESTS 39 61 8294400 1500
59131324 vjudge3 D Aug. 20, 2019, 11:07 a.m. OK MS C++ 2017 TESTS 39 62 409600 1500
50584838 work_hard. D Feb. 28, 2019, 2:20 a.m. OK MS C++ 2017 TESTS 39 62 409600 1500
59129836 920848348 D Aug. 20, 2019, 10:32 a.m. OK MS C++ 2017 TESTS 39 62 1638400 1500
65399490 WrongWayboyyy D Nov. 19, 2019, 8:55 p.m. OK MS C++ 2017 TESTS 39 93 409600 1500
48794699 vjudge1 D Jan. 23, 2019, 12:14 p.m. OK Node.js TESTS 39 187 12083200 1500
39895636 mayakin D July 3, 2018, 1:46 p.m. OK PHP TESTS 39 62 8396800 1500
38930140 Onesh0t D June 3, 2018, 8:37 p.m. OK PyPy 2 TESTS 39 109 30924800 1500
67671158 AnandOza D Dec. 26, 2019, 8:33 p.m. OK PyPy 2 TESTS 39 140 9523200 1500
38786465 frmsaul D May 30, 2018, 11:10 p.m. OK PyPy 2 TESTS 39 140 34406400 1500
68053842 fortmax120 D Jan. 1, 2020, 8:37 p.m. OK PyPy 2 TESTS 39 171 10649600 1500
42309476 akshay125 D Aug. 31, 2018, 1:24 p.m. OK PyPy 2 TESTS 39 217 7680000 1500
68065558 fortmax120 D Jan. 2, 2020, 7:31 a.m. OK PyPy 2 TESTS 39 249 7475200 1500
38709841 zjuwyz D May 29, 2018, 5:31 a.m. OK PyPy 3 TESTS 39 202 11161600 1500
45022792 omarnvidia D Oct. 28, 2018, 7:49 p.m. OK PyPy 3 TESTS 39 218 11059200 1500
53607032 yfo D May 1, 2019, 10:57 a.m. OK PyPy 3 TESTS 39 218 11878400 1500
66557720 manish.17 D Dec. 9, 2019, 5:32 p.m. OK PyPy 3 TESTS 39 218 12800000 1500
51381386 aleonov D March 16, 2019, 4:26 p.m. OK PyPy 3 TESTS 39 218 13312000 1500
58569717 brosucks D Aug. 11, 2019, 9:33 a.m. OK PyPy 3 TESTS 39 233 10240000 1500
54736309 Aidos D May 28, 2019, 5:12 a.m. OK PyPy 3 TESTS 39 233 14438400 1500
61216185 neterukun D Sept. 24, 2019, 12:47 p.m. OK PyPy 3 TESTS 39 234 11264000 1500
62559598 UTMoonlight D Oct. 14, 2019, 11:36 a.m. OK PyPy 3 TESTS 39 264 16588800 1500
62384511 ashok123 D Oct. 11, 2019, 8:35 p.m. OK PyPy 3 TESTS 39 280 13619200 1500
38697188 abhishektiwari D May 28, 2018, 2:41 p.m. OK Python 2 TESTS 39 249 6451200 1500
39608177 alankrit_singh_1 D June 24, 2018, 4:31 p.m. OK Python 2 TESTS 39 296 5632000 1500
47816905 Skybytskyi.Nikita D Jan. 1, 2019, 3:02 p.m. OK Python 3 TESTS 39 202 8089600 1500
60063717 inglar D Sept. 5, 2019, 8:11 a.m. OK Python 3 TESTS 39 202 8396800 1500
39933587 orailly D July 3, 2018, 6:47 p.m. OK Python 3 TESTS 39 202 10444800 1500
39934001 orailly D July 3, 2018, 7:05 p.m. OK Python 3 TESTS 39 218 10240000 1500
48797051 vjudge5 D Jan. 23, 2019, 1:02 p.m. OK Python 3 TESTS 39 280 8089600 1500
48797027 __Wind__ D Jan. 23, 2019, 1:01 p.m. OK Python 3 TESTS 39 280 8089600 1500
40645850 tebba D July 22, 2018, 4:01 p.m. OK Python 3 TESTS 39 280 8396800 1500
62552705 cameliapatilea D Oct. 14, 2019, 9:20 a.m. OK Python 3 TESTS 39 295 8396800 1500
39893702 orailly D July 3, 2018, 12:33 p.m. OK Python 3 TESTS 39 295 8396800 1500
39190176 Vasiliy_48 D June 12, 2018, 11:45 a.m. OK Python 3 TESTS 39 311 8396800 1500
38554984 blazeva1 D May 23, 2018, 7:58 a.m. OK Rust TESTS 39 61 6758400 1500
41547183 kobae964 D Aug. 13, 2018, 6:03 a.m. OK Rust TESTS 39 93 106700800 1500
46716007 yakamoto D Dec. 7, 2018, 11:14 a.m. OK Scala TESTS 39 483 0 1500

remove filters

Back to search problems