Codeforces Round 446 (Div. 1)

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
891 Codeforces Round 446 (Div. 1) FINISHED False 7200 220893899 Nov. 17, 2017, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 10293 ) A Pride PROGRAMMING brute force dp greedy math number theory 1600

B'You have an array a with length n, you can perform operations. Each operation is like this: choose two adjacent elements from a, say x and y, and replace one of them with gcd(x, xe2 x80 x89y), where gcd denotes the greatest common divisor. What is the minimum number of operations you need to make all of the elements equal to 1? The first line of the input contains one integer n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x892000) -- the number of elements in the array. The second line contains n space separated 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 x89109) -- the elements of the array. Print -1, if it is impossible to turn all numbers to 1. Otherwise, print the minimum number of operations needed to make all numbers equal to 1. In the first sample you can turn all numbers to 1 using the following 5 moves: We can prove that in this case it is not possible to make all numbers one using less than 5 moves. '...

Tutorials

Codeforces Round #446 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
45856334 JonathanWang A Nov. 17, 2018, 2:18 a.m. OK Clang++17 Diagnostics TESTS 52 77 0 1600
45856576 JonathanWang A Nov. 17, 2018, 2:28 a.m. OK Clang++17 Diagnostics TESTS 52 77 307200 1600
32384182 Gassa A Nov. 17, 2017, 2:44 p.m. OK D TESTS 52 31 4198400 1600
32395562 yosupo A Nov. 17, 2017, 3:30 p.m. OK D TESTS 52 46 4198400 1600
50789432 cpy A March 4, 2019, 2:57 p.m. OK D TESTS 52 46 4300800 1600
34916670 beng A Feb. 4, 2018, 7:22 a.m. OK FPC TESTS 52 15 1740800 1600
46568661 khoa101003 A Dec. 4, 2018, 3:21 a.m. OK FPC TESTS 52 46 16076800 1600
33136021 Izanagi A Dec. 11, 2017, 6:47 p.m. OK GNU C TESTS 52 15 1843200 1600
32494010 zojker A Nov. 20, 2017, 9:01 a.m. OK GNU C TESTS 52 30 0 1600
35045154 lnred A Feb. 8, 2018, 5:31 a.m. OK GNU C TESTS 52 30 1843200 1600
32903381 Ibn_Masud A Dec. 3, 2017, 4:21 p.m. OK GNU C TESTS 52 30 1843200 1600
32810853 HaiTien A Nov. 30, 2017, 4:14 p.m. OK GNU C TESTS 52 30 1843200 1600
32511868 timebreaker A Nov. 20, 2017, 9:42 p.m. OK GNU C TESTS 52 31 0 1600
32692489 sadiaanjum A Nov. 26, 2017, 6:24 p.m. OK GNU C TESTS 52 31 1843200 1600
34037638 pveras A Jan. 9, 2018, 12:07 a.m. OK GNU C TESTS 52 31 17920000 1600
38793039 tanvirbd A May 31, 2018, 7:13 a.m. OK GNU C TESTS 52 46 3379200 1600
32782343 shivanya A Nov. 29, 2017, 1:50 p.m. OK GNU C TESTS 52 1279 1843200 1600
32428529 vjudge3 A Nov. 18, 2017, 11:11 a.m. OK GNU C++ TESTS 52 15 0 1600
32560140 a2357 A Nov. 22, 2017, 7:26 p.m. OK GNU C++ TESTS 52 15 0 1600
32499789 vjudge5 A Nov. 20, 2017, 12:50 p.m. OK GNU C++ TESTS 52 15 0 1600
32491036 2014slx A Nov. 20, 2017, 6:38 a.m. OK GNU C++ TESTS 52 15 0 1600
32428558 Blurgy A Nov. 18, 2017, 11:12 a.m. OK GNU C++ TESTS 52 15 0 1600
32422627 yypurpose12345 A Nov. 18, 2017, 6:46 a.m. OK GNU C++ TESTS 52 15 0 1600
32388308 __stdcall A Nov. 17, 2017, 2:58 p.m. OK GNU C++ TESTS 52 15 0 1600
32385533 Vendetta. A Nov. 17, 2017, 2:47 p.m. OK GNU C++ TESTS 52 15 0 1600
32381612 Haghani A Nov. 17, 2017, 2:37 p.m. OK GNU C++ TESTS 52 15 0 1600
32428841 Random_chen A Nov. 18, 2017, 11:24 a.m. OK GNU C++ TESTS 52 15 204800 1600
35045168 vjudge4 A Feb. 8, 2018, 5:31 a.m. OK GNU C11 TESTS 52 31 1843200 1600
32857239 2465806616 A Dec. 2, 2017, 12:04 p.m. OK GNU C11 TESTS 52 31 1843200 1600
33800059 saltchicken A Dec. 30, 2017, 3:50 a.m. OK GNU C11 TESTS 52 31 1843200 1600
69617278 youssefvictor00 A Jan. 27, 2020, 1:28 p.m. OK GNU C11 TESTS 52 46 0 1600
35044704 vjudge3 A Feb. 8, 2018, 5:12 a.m. OK GNU C11 TESTS 52 46 1843200 1600
32424586 hawkomg A Nov. 18, 2017, 8:25 a.m. OK GNU C++11 TESTS 52 15 0 1600
32385128 fragusbot A Nov. 17, 2017, 2:46 p.m. OK GNU C++11 TESTS 52 15 0 1600
32383094 -eidolon- A Nov. 17, 2017, 2:41 p.m. OK GNU C++11 TESTS 52 15 0 1600
32382399 M.Mahdi A Nov. 17, 2017, 2:39 p.m. OK GNU C++11 TESTS 52 15 0 1600
32386895 Logsha A Nov. 17, 2017, 2:52 p.m. OK GNU C++11 TESTS 52 15 0 1600
32388845 retired_coder A Nov. 17, 2017, 3 p.m. OK GNU C++11 TESTS 52 15 0 1600
32390331 y0105w49 A Nov. 17, 2017, 3:06 p.m. OK GNU C++11 TESTS 52 15 0 1600
32391619 osamahatem A Nov. 17, 2017, 3:12 p.m. OK GNU C++11 TESTS 52 15 0 1600
32409379 Sorsweet A Nov. 17, 2017, 6:50 p.m. OK GNU C++11 TESTS 52 15 0 1600
32386373 sqrtdecompton A Nov. 17, 2017, 2:50 p.m. OK GNU C++11 TESTS 52 15 512000 1600
32407187 ogo A Nov. 17, 2017, 6:12 p.m. OK GNU C++14 TESTS 52 15 0 1600
32515706 Asm.Def A Nov. 21, 2017, 4:48 a.m. OK GNU C++14 TESTS 52 15 0 1600
32435033 Dalenator A Nov. 18, 2017, 3:18 p.m. OK GNU C++14 TESTS 52 15 0 1600
32427727 AMnu A Nov. 18, 2017, 10:38 a.m. OK GNU C++14 TESTS 52 15 0 1600
32423313 nukeykt A Nov. 18, 2017, 7:19 a.m. OK GNU C++14 TESTS 52 15 0 1600
32419343 usernameson A Nov. 18, 2017, 3:33 a.m. OK GNU C++14 TESTS 52 15 0 1600
32418180 Bassel A Nov. 18, 2017, 2:09 a.m. OK GNU C++14 TESTS 52 15 0 1600
32414345 KarimElSheikh A Nov. 17, 2017, 9:08 p.m. OK GNU C++14 TESTS 52 15 0 1600
32408651 please_delete_account A Nov. 17, 2017, 6:37 p.m. OK GNU C++14 TESTS 52 15 0 1600
32407186 rookie_0129 A Nov. 17, 2017, 6:12 p.m. OK GNU C++14 TESTS 52 15 0 1600
36233860 Amaurya A March 12, 2018, 7:37 p.m. OK GNU C++17 TESTS 52 30 6041600 1600
66556109 tanya9 A Dec. 9, 2019, 4:52 p.m. OK GNU C++17 TESTS 52 31 0 1600
65800868 vjudge2 A Nov. 27, 2019, 7:22 a.m. OK GNU C++17 TESTS 52 31 0 1600
68432908 Igor_2017 A Jan. 9, 2020, 7:41 a.m. OK GNU C++17 TESTS 52 31 0 1600
67038332 ujjwalsingh30 A Dec. 16, 2019, 6:13 p.m. OK GNU C++17 TESTS 52 31 0 1600
68719526 Rahul_cpp A Jan. 13, 2020, 3:42 p.m. OK GNU C++17 TESTS 52 31 0 1600
68923162 SharpC A Jan. 16, 2020, 9:48 a.m. OK GNU C++17 TESTS 52 31 0 1600
69679863 mon.shy A Jan. 28, 2020, 3:18 p.m. OK GNU C++17 TESTS 52 31 0 1600
69679885 Sobachnyk A Jan. 28, 2020, 3:18 p.m. OK GNU C++17 TESTS 52 31 0 1600
68296654 SeyedAmirHosseini A Jan. 6, 2020, 3:22 a.m. OK GNU C++17 TESTS 52 31 0 1600
32519179 Brone A Nov. 21, 2017, 8:05 a.m. OK GNU C++17 Diagnostics TESTS 52 1201 0 1600
34989916 vjudge2 A Feb. 7, 2018, 6:22 a.m. OK Go TESTS 52 62 22937600 1600
69595080 Katushechka A Jan. 27, 2020, 4:03 a.m. OK Java 8 TESTS 52 124 0 1600
68056219 pushpraj17307 A Jan. 1, 2020, 10:58 p.m. OK Java 8 TESTS 52 124 0 1600
55117808 hasan5788 A June 5, 2019, 9:29 a.m. OK Java 8 TESTS 52 124 0 1600
47031834 kusomushi A Dec. 15, 2018, 10:17 a.m. OK Java 8 TESTS 52 124 0 1600
40879853 octopusPrime A July 28, 2018, 10:08 a.m. OK Java 8 TESTS 52 124 0 1600
32995474 In_The_Name_Of_Love A Dec. 7, 2017, 8:22 a.m. OK Java 8 TESTS 52 124 20582400 1600
35185998 Vaibhav96 A Feb. 12, 2018, 5:59 p.m. OK Java 8 TESTS 52 124 20684800 1600
33916059 tri A Jan. 5, 2018, 5:36 a.m. OK Java 8 TESTS 52 124 20684800 1600
68778741 lazypanda A Jan. 14, 2020, 2:18 p.m. OK Java 8 TESTS 52 139 0 1600
41617113 Jarik A Aug. 15, 2018, 9:54 a.m. OK Java 8 TESTS 52 139 0 1600
32419866 farizazmip A Nov. 18, 2017, 4:12 a.m. OK JavaScript TESTS 52 61 1433600 1600
51447211 nemars A March 18, 2019, 1:03 p.m. OK Mono C# TESTS 52 77 3686400 1600
32412607 leign A Nov. 17, 2017, 7:58 p.m. OK MS C# TESTS 52 62 102400 1600
32443829 Azizxon_uz A Nov. 18, 2017, 10:42 p.m. OK MS C# TESTS 52 77 11878400 1600
33828886 vjudge2 A Dec. 31, 2017, 9:51 a.m. OK MS C++ TESTS 52 15 2048000 1600
32942831 Chop A Dec. 5, 2017, 8:26 a.m. OK MS C++ TESTS 52 15 2150400 1600
32383637 waltz A Nov. 17, 2017, 2:42 p.m. OK MS C++ TESTS 52 30 0 1600
32432789 marszed A Nov. 18, 2017, 1:47 p.m. OK MS C++ TESTS 52 30 204800 1600
46312409 vjudge2 A Nov. 28, 2018, 1:57 p.m. OK MS C++ TESTS 52 31 0 1600
69551100 vjudge1 A Jan. 26, 2020, 6:29 a.m. OK MS C++ TESTS 52 31 0 1600
46504882 vjudge5 A Dec. 2, 2018, 10:52 a.m. OK MS C++ TESTS 52 31 0 1600
46395105 vjudge4 A Nov. 30, 2018, 8:42 a.m. OK MS C++ TESTS 52 31 0 1600
46363031 vjudge2 A Nov. 29, 2018, 12:01 p.m. OK MS C++ TESTS 52 31 0 1600
46317890 vjudge5 A Nov. 28, 2018, 2:55 p.m. OK MS C++ TESTS 52 31 0 1600
59563680 CtrlAlt A Aug. 27, 2019, 9:45 a.m. OK MS C++ 2017 TESTS 52 46 0 1600
65162612 yuanyuan2048 A Nov. 16, 2019, noon OK MS C++ 2017 TESTS 52 46 16179200 1600
32433506 farizazmip A Nov. 18, 2017, 2:14 p.m. OK PHP TESTS 52 530 5939200 1600
32415264 llllllll A Nov. 17, 2017, 10:04 p.m. OK PyPy 2 TESTS 52 265 7782400 1600
32482155 nealzane A Nov. 19, 2017, 7:16 p.m. OK PyPy 2 TESTS 52 280 25600000 1600
43493443 soumyasarkar1998 A Sept. 27, 2018, 1:37 p.m. OK PyPy 2 TESTS 52 358 10752000 1600
54248791 ragnar7 A May 16, 2019, 4:08 p.m. OK PyPy 3 TESTS 52 233 1228800 1600
45458877 Marii A Nov. 8, 2018, 9:52 p.m. OK PyPy 3 TESTS 52 233 8601600 1600
61336158 vishhesh A Sept. 26, 2019, 4:29 p.m. OK PyPy 3 TESTS 52 264 3379200 1600
61701387 adivannik A Oct. 2, 2019, 8:40 a.m. OK PyPy 3 TESTS 52 265 2662400 1600
49850058 111vad111 A Feb. 13, 2019, 2:40 a.m. OK PyPy 3 TESTS 52 295 18124800 1600
32456467 DSRub A Nov. 19, 2017, 12:27 p.m. OK PyPy 3 TESTS 52 389 40140800 1600
32453500 xhae A Nov. 19, 2017, 10:18 a.m. OK PyPy 3 TESTS 52 421 40140800 1600
46464282 homoeconomicus A Dec. 2, 2018, 12:21 a.m. OK PyPy 3 TESTS 52 452 20582400 1600
68055118 3x7 A Jan. 1, 2020, 9:48 p.m. OK PyPy 3 TESTS 52 530 11673600 1600
32420132 rohitbro A Nov. 18, 2017, 4:28 a.m. OK Python 2 TESTS 52 951 204800 1600
33262369 tnowakow A Dec. 15, 2017, 11:53 a.m. OK Python 2 TESTS 52 998 9932800 1600
55194583 anshuman16423 A June 6, 2019, 7:56 a.m. OK Python 2 TESTS 52 1138 2048000 1600
32434134 xlk A Nov. 18, 2017, 2:40 p.m. OK Python 2 TESTS 52 1279 4812800 1600
38988674 Ali_Pi A June 6, 2018, 8:45 a.m. OK Python 2 TESTS 52 1325 102400 1600
32417007 wangkan2001 A Nov. 18, 2017, 12:35 a.m. OK Python 2 TESTS 52 1778 102400 1600
32431693 s_p A Nov. 18, 2017, 1:06 p.m. OK Python 3 TESTS 52 77 0 1600
59868994 LintuStorm A Sept. 1, 2019, 6:26 p.m. OK Python 3 TESTS 52 124 307200 1600
32819201 orailly A Dec. 1, 2017, 1:08 a.m. OK Python 3 TESTS 52 389 6246400 1600
32629557 maratonando3 A Nov. 24, 2017, 6:32 p.m. OK Python 3 TESTS 52 499 5632000 1600
33057664 DevilJin A Dec. 9, 2017, 5:42 p.m. OK Python 3 TESTS 52 623 5529600 1600
32568675 jvjhfhg A Nov. 23, 2017, 7:35 a.m. OK Python 3 TESTS 52 732 0 1600
32450568 sunhong A Nov. 19, 2017, 8:01 a.m. OK Python 3 TESTS 52 779 5529600 1600
43561437 spellstaker A Sept. 29, 2018, 9:13 a.m. OK Python 3 TESTS 52 841 512000 1600
47467603 shaikh_ubaid A Dec. 24, 2018, 7:16 p.m. OK Python 3 TESTS 52 842 0 1600
32455252 atryapa A Nov. 19, 2017, 11:35 a.m. OK Python 3 TESTS 52 857 5632000 1600
32419665 farizazmip A Nov. 18, 2017, 3:57 a.m. OK Ruby TESTS 52 280 102400 1600
32417905 dandersonw A Nov. 18, 2017, 1:49 a.m. OK Scala TESTS 52 1279 61952000 1600

remove filters

Back to search problems