Codeforces Round 830 (Div. 2)

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
1732 Codeforces Round 830 (Div. 2) FINISHED False 7200 65303699 Oct. 23, 2022, 10:05 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 15147 ) A Bestie PROGRAMMING brute force constructive algorithms implementation math number theory 1000

B"You are given an array a consisting of n integers a_1, a_2, ldots, a_n . Friends asked you to make the greatest common divisor (GCD) of all numbers in the array equal to 1 . In one operation, you can do the following: You need to find the minimum total cost of operations we need to perform so that the GCD of the all array numbers becomes equal to 1 . Each test consists of multiple test cases. The first line contains an integer t ( 1 <= q t <= q 5 ,000 ) -- the number of test cases. The description of test cases follows. The first line of each test case contains a single integer n ( 1 <= q n <= q 20 ) -- the length of the array. The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 1 <= q a_i <= q 10^9 ) -- the elements of the array. For each test case, output a single integer -- the minimum total cost of operations that will need to be performed so that the GCD of all numbers in the array becomes equal to 1 . We can show that it's always possible to do so. In the first test case, the GCD of the entire array is already equal to 1 , so there is no need to perform operations. In the second test case, select i = 1 . After this operation, a_1 = gcd(2, 1) = 1 . The cost of this operation is 1 . In the third test case, you can select i = 1 , after that the array a will be equal to [1, 4] . The GCD of this array is 1 , and the total cost is 2 . In the fourth test case, you can select i = 2 , after that the array a will be equal to [3, 2, 9] . The GCD of this array is 1 , and the total cost is 2 . In the sixth test case, you can select i = 4 and i = 5 , after that the array a will be equal to [120, 60, 80, 4, 5] . The GCD of this array is 1 , and the total cost is 3 . "...

Tutorials

108327

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
177699013 sergmel A Oct. 23, 2022, 9:16 p.m. OK C# 10 TESTS 8 77 3072000 1000
177702550 FatalityNT A Oct. 23, 2022, 10:53 p.m. OK C# 8 TESTS 8 156 3379200 1000
177702573 FatalityNT A Oct. 23, 2022, 10:54 p.m. OK C# 8 TESTS 8 170 3379200 1000
177705102 Longed4Power A Oct. 24, 2022, 12:16 a.m. OK Clang++17 Diagnostics TESTS 8 530 1024000 1000
177637122 cyrus_msk A Oct. 23, 2022, 11:46 a.m. OK D TESTS 8 31 1945600 1000
177629865 Shubham_Patel_1 A Oct. 23, 2022, 11:20 a.m. OK GNU C11 TESTS 8 62 204800 1000
177640097 zl17 A Oct. 23, 2022, 11:57 a.m. OK GNU C11 TESTS 8 78 0 1000
177714302 xsdjg A Oct. 24, 2022, 3:35 a.m. OK GNU C++14 TESTS 8 15 921600 1000
177649662 shenyibin A Oct. 23, 2022, 1:32 p.m. OK GNU C++14 TESTS 8 30 0 1000
177649094 dina.saba97 A Oct. 23, 2022, 1:29 p.m. OK GNU C++14 TESTS 8 30 0 1000
177662425 zxr55555 A Oct. 23, 2022, 3:02 p.m. OK GNU C++14 TESTS 8 30 0 1000
177704221 Mine_King A Oct. 23, 2022, 11:49 p.m. OK GNU C++14 TESTS 8 30 0 1000
177673093 akshatjai258 A Oct. 23, 2022, 4:30 p.m. OK GNU C++14 TESTS 8 30 204800 1000
177719646 pjccccc A Oct. 24, 2022, 5:12 a.m. OK GNU C++14 TESTS 8 30 2048000 1000
177714232 zzjd12321 A Oct. 24, 2022, 3:33 a.m. OK GNU C++14 TESTS 8 31 0 1000
177721881 bb_16 A Oct. 24, 2022, 5:46 a.m. OK GNU C++14 TESTS 8 31 0 1000
177718369 rui_er A Oct. 24, 2022, 4:51 a.m. OK GNU C++14 TESTS 8 31 0 1000
177629443 shivavalluri1122 A Oct. 23, 2022, 11:19 a.m. OK GNU C++17 TESTS 8 15 0 1000
177642008 iftakharahmedchowdhury A Oct. 23, 2022, 12:03 p.m. OK GNU C++17 TESTS 8 15 0 1000
177686963 AbdalrahmanShaaban A Oct. 23, 2022, 6:48 p.m. OK GNU C++17 TESTS 8 15 0 1000
177657809 _ghulam2545 A Oct. 23, 2022, 2:26 p.m. OK GNU C++17 TESTS 8 15 102400 1000
177659447 Cyber_123 A Oct. 23, 2022, 2:38 p.m. OK GNU C++17 TESTS 8 30 0 1000
177651720 ForMyLove A Oct. 23, 2022, 1:44 p.m. OK GNU C++17 TESTS 8 30 102400 1000
177671927 whiteflags26 A Oct. 23, 2022, 4:20 p.m. OK GNU C++17 TESTS 8 30 102400 1000
177660871 yogirajfulpagar9193 A Oct. 23, 2022, 2:49 p.m. OK GNU C++17 TESTS 8 30 102400 1000
177718611 vicky_raj A Oct. 24, 2022, 4:55 a.m. OK GNU C++17 TESTS 8 30 204800 1000
177653348 sanjayprajapati A Oct. 23, 2022, 1:54 p.m. OK GNU C++17 TESTS 8 30 204800 1000
177704215 q-w-q-w-q A Oct. 23, 2022, 11:49 p.m. OK GNU C++17 (64) TESTS 8 15 0 1000
177706238 enslaved A Oct. 24, 2022, 12:51 a.m. OK GNU C++17 (64) TESTS 8 15 0 1000
177694543 PurpleCrayon A Oct. 23, 2022, 7:59 p.m. OK GNU C++17 (64) TESTS 8 15 0 1000
177677898 Maheen654 A Oct. 23, 2022, 5:16 p.m. OK GNU C++17 (64) TESTS 8 15 0 1000
177677564 mesbah19 A Oct. 23, 2022, 5:13 p.m. OK GNU C++17 (64) TESTS 8 15 0 1000
177675043 Omja A Oct. 23, 2022, 4:48 p.m. OK GNU C++17 (64) TESTS 8 15 0 1000
177664316 dbest A Oct. 23, 2022, 3:16 p.m. OK GNU C++17 (64) TESTS 8 15 0 1000
177722698 zhongzhong A Oct. 24, 2022, 5:57 a.m. OK GNU C++17 (64) TESTS 8 15 1638400 1000
177651515 Jack00 A Oct. 23, 2022, 1:42 p.m. OK GNU C++17 (64) TESTS 8 15 3174400 1000
177708392 Hytidel A Oct. 24, 2022, 1:47 a.m. OK GNU C++17 (64) TESTS 8 30 0 1000
177718846 aspireboy A Oct. 24, 2022, 4:59 a.m. OK GNU C++20 (64) TESTS 8 15 0 1000
177716611 A__S A Oct. 24, 2022, 4:18 a.m. OK GNU C++20 (64) TESTS 8 15 0 1000
177713800 AdityaJha A Oct. 24, 2022, 3:26 a.m. OK GNU C++20 (64) TESTS 8 15 0 1000
177712312 MeDoCodeIs A Oct. 24, 2022, 3:01 a.m. OK GNU C++20 (64) TESTS 8 15 0 1000
177711720 Siddharth_777 A Oct. 24, 2022, 2:50 a.m. OK GNU C++20 (64) TESTS 8 15 0 1000
177710123 Venti_chai A Oct. 24, 2022, 2:22 a.m. OK GNU C++20 (64) TESTS 8 15 0 1000
177691919 sidnigam A Oct. 23, 2022, 7:21 p.m. OK GNU C++20 (64) TESTS 8 15 0 1000
177705993 Ice_Bear521 A Oct. 24, 2022, 12:44 a.m. OK GNU C++20 (64) TESTS 8 15 0 1000
177722960 BinaryThinker A Oct. 24, 2022, 6 a.m. OK GNU C++20 (64) TESTS 8 15 0 1000
177721102 i.afshanshekh A Oct. 24, 2022, 5:35 a.m. OK GNU C++20 (64) TESTS 8 15 0 1000
177634861 mtarunsai1999 A Oct. 23, 2022, 11:38 a.m. OK Go TESTS 8 77 2457600 1000
177706128 iamavalon A Oct. 24, 2022, 12:48 a.m. OK Java 11 TESTS 8 170 0 1000
177676721 princeayush04 A Oct. 23, 2022, 5:05 p.m. OK Java 11 TESTS 8 171 0 1000
177711044 PrincessParsley A Oct. 24, 2022, 2:38 a.m. OK Java 11 TESTS 8 186 0 1000
177650712 shojin_pro A Oct. 23, 2022, 1:38 p.m. OK Java 11 TESTS 8 202 0 1000
177664144 aditya2024 A Oct. 23, 2022, 3:15 p.m. OK Java 11 TESTS 8 218 0 1000
177660636 kaifkhan.biz A Oct. 23, 2022, 2:48 p.m. OK Java 11 TESTS 8 233 0 1000
177657731 RahulJangir A Oct. 23, 2022, 2:25 p.m. OK Java 11 TESTS 8 249 0 1000
177718729 Sachin872003 A Oct. 24, 2022, 4:57 a.m. OK Java 11 TESTS 8 358 0 1000
177656056 bhavesh1914 A Oct. 23, 2022, 2:12 p.m. OK Java 11 TESTS 8 374 0 1000
177632841 Wld A Oct. 23, 2022, 11:31 a.m. OK Java 11 TESTS 8 904 0 1000
177638977 Vectorss A Oct. 23, 2022, 11:53 a.m. OK Java 17 TESTS 8 186 409600 1000
177666614 koolkartik A Oct. 23, 2022, 3:35 p.m. OK Java 17 TESTS 8 202 409600 1000
177652494 kkz666 A Oct. 23, 2022, 1:48 p.m. OK Java 17 TESTS 8 218 0 1000
177670900 _Abeke_ A Oct. 23, 2022, 4:11 p.m. OK Java 17 TESTS 8 389 409600 1000
177630019 oliver_ A Oct. 23, 2022, 11:21 a.m. OK Java 17 TESTS 8 436 307200 1000
177630248 Thejas_n A Oct. 23, 2022, 11:22 a.m. OK Java 17 TESTS 8 608 0 1000
177701402 RahulAhuja2901 A Oct. 23, 2022, 10:16 p.m. OK Java 8 TESTS 8 93 0 1000
177673587 ahmedtawfik A Oct. 23, 2022, 4:35 p.m. OK Java 8 TESTS 8 109 0 1000
177654772 ljaewon97 A Oct. 23, 2022, 2:03 p.m. OK Java 8 TESTS 8 109 0 1000
177720847 gssakash A Oct. 24, 2022, 5:31 a.m. OK Java 8 TESTS 8 124 0 1000
177693120 gagan_6730 A Oct. 23, 2022, 7:37 p.m. OK Java 8 TESTS 8 124 0 1000
177670004 Java_Programmer A Oct. 23, 2022, 4:03 p.m. OK Java 8 TESTS 8 124 0 1000
177657222 youtsuha A Oct. 23, 2022, 2:21 p.m. OK Java 8 TESTS 8 124 0 1000
177650450 anshulchou_123 A Oct. 23, 2022, 1:36 p.m. OK Java 8 TESTS 8 124 0 1000
177653783 Otepbergen A Oct. 23, 2022, 1:57 p.m. OK Java 8 TESTS 8 124 4300800 1000
177711555 ankit_0207 A Oct. 24, 2022, 2:48 a.m. OK Java 8 TESTS 8 140 0 1000
177657092 Gompu123 A Oct. 23, 2022, 2:20 p.m. OK Kotlin 1.5 TESTS 8 218 0 1000
177664800 ktropin A Oct. 23, 2022, 3:20 p.m. OK Mono C# TESTS 8 92 6860800 1000
177697205 whiteReboot A Oct. 23, 2022, 8:42 p.m. OK MS C++ 2017 TESTS 8 108 0 1000
177718764 lyqhh88 A Oct. 24, 2022, 4:58 a.m. OK MS C++ 2017 TESTS 8 109 0 1000
177637779 KFrom40 A Oct. 23, 2022, 11:49 a.m. OK PHP TESTS 8 62 0 1000
177631484 victory.subbu567 A Oct. 23, 2022, 11:26 a.m. OK PyPy 3 TESTS 8 312 8704000 1000
177637267 watubub A Oct. 23, 2022, 11:47 a.m. OK PyPy 3 TESTS 8 390 9625600 1000
177663469 atharva3008 A Oct. 23, 2022, 3:10 p.m. OK PyPy 3 TESTS 8 405 9625600 1000
177629159 GRL A Oct. 23, 2022, 11:18 a.m. OK PyPy 3 TESTS 8 436 9932800 1000
177630436 Vashi A Oct. 23, 2022, 11:22 a.m. OK PyPy 3 TESTS 8 498 10035200 1000
177696895 crapcode A Oct. 23, 2022, 8:36 p.m. OK PyPy 3-64 TESTS 8 109 6246400 1000
177691353 huikang A Oct. 23, 2022, 7:13 p.m. OK PyPy 3-64 TESTS 8 140 8908800 1000
177649712 biglunchdude A Oct. 23, 2022, 1:32 p.m. OK PyPy 3-64 TESTS 8 140 9420800 1000
177675532 zouyu9631 A Oct. 23, 2022, 4:53 p.m. OK PyPy 3-64 TESTS 8 140 9830400 1000
177686395 KanishkGoel A Oct. 23, 2022, 6:41 p.m. OK PyPy 3-64 TESTS 8 155 9830400 1000
177685992 ahmedsiad A Oct. 23, 2022, 6:37 p.m. OK PyPy 3-64 TESTS 8 155 9932800 1000
177679121 mrdhnv A Oct. 23, 2022, 5:27 p.m. OK PyPy 3-64 TESTS 8 155 10035200 1000
177676610 unknown91 A Oct. 23, 2022, 5:04 p.m. OK PyPy 3-64 TESTS 8 155 10137600 1000
177635175 AfsanHabib A Oct. 23, 2022, 11:39 a.m. OK PyPy 3-64 TESTS 8 170 9625600 1000
177652666 biglunchdude A Oct. 23, 2022, 1:50 p.m. OK PyPy 3-64 TESTS 8 171 9728000 1000
177684244 alduin0 A Oct. 23, 2022, 6:17 p.m. OK Python 3 TESTS 8 62 204800 1000
177722474 dustbite A Oct. 24, 2022, 5:54 a.m. OK Python 3 TESTS 8 124 0 1000
177711336 odinluca A Oct. 24, 2022, 2:44 a.m. OK Python 3 TESTS 8 124 0 1000
177683283 Virus47 A Oct. 23, 2022, 6:07 p.m. OK Python 3 TESTS 8 124 0 1000
177682704 Sabuj_arif A Oct. 23, 2022, 6:01 p.m. OK Python 3 TESTS 8 124 0 1000
177682396 Sabuj_arif A Oct. 23, 2022, 5:58 p.m. OK Python 3 TESTS 8 124 0 1000
177660423 nagasaikayithi A Oct. 23, 2022, 2:46 p.m. OK Python 3 TESTS 8 124 0 1000
177635146 guset17 A Oct. 23, 2022, 11:39 a.m. OK Python 3 TESTS 8 124 0 1000
177630020 TheBoyNextDoor_1 A Oct. 23, 2022, 11:21 a.m. OK Python 3 TESTS 8 124 0 1000
177663003 Pawan_Lahoti A Oct. 23, 2022, 3:06 p.m. OK Python 3 TESTS 8 139 0 1000

remove filters

Back to search problems