Codeforces Round 846 (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
1780 Codeforces Round 846 (Div. 2) FINISHED False 7200 62522663 Jan. 25, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 19048 ) B GCD Partition PROGRAMMING brute force greedy math number theory

B"While at Kira's house, Josuke saw a piece of paper on the table with a task written on it. The task sounded as follows. There is an array a of length n . On this array, do the following: The task is to find such a partition that the score is maximum possible. Josuke is interested in this task but is not strong in computer science. Help him to find the maximum possible score. ^ dagger A division of an array into k subsegments is k pairs of numbers (l_1, r_1), (l_2, r_2), ldots, (l_k, r_k) such that l_i <= r_i and for every 1 <= j <= k - 1 l_{j + 1} = r_j + 1 , also l_1 = 1 and r_k = n . These pairs represent the subsegments. ^ ddagger gcd(b_1, b_2, ldots, b_k) stands for the greatest common divisor (GCD) of the array b . The first line contains a single number t ( 1 <= t <= 10^4 ) -- the number of test cases. For each test case, the first line contains one integer n ( 2 <= n <= 2 cdot 10^5 ) -- the length of the array a . The second line contains n integers a_1, a_2, a_3, ldots, a_n ( 1 <= a_i <= 10^9 ) -- the array a itself. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case print a single integer -- the maximum score for the optimal partition. In the first test case, you can choose k = 2 and split the array into subsegments (1, 2) and (3, 4) . Then the score of such a partition will be equal to gcd(a_1 + a_2, a_3 + a_4) = gcd(2 + 2, 1 + 3) = gcd(4, 4) = 4 . In the fourth test case, you can choose k = 3 and split the array into subsegments (1, 2), (3, 5), (6, 6) . The split score is gcd(1 + 2, 1 + 1 + 1, 3) = 3 . "...

Tutorials

111841

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
190616162 awhfahim B Jan. 26, 2023, 5:59 a.m. OK C# 10 TESTS 16 140 26112000
190597559 bluemegane B Jan. 25, 2023, 10:27 p.m. OK C# 8 TESTS 16 171 25292800
190552318 NenadDapic B Jan. 25, 2023, 3:54 p.m. OK FPC TESTS 16 139 1740800
190603562 parth_bh B Jan. 26, 2023, 1:46 a.m. OK GNU C11 TESTS 16 108 3174400
190571207 1435730 B Jan. 25, 2023, 5:21 p.m. OK GNU C11 TESTS 16 124 819200
190602270 Bugakov_Ivan B Jan. 26, 2023, 1:03 a.m. OK GNU C11 TESTS 16 124 1638400
190571913 oculis B Jan. 25, 2023, 5:25 p.m. OK GNU C11 TESTS 16 124 3174400
190547775 codeforces111672 B Jan. 25, 2023, 3:43 p.m. OK GNU C++14 TESTS 16 93 136089600
190599580 Yousef_Sayed B Jan. 25, 2023, 11:27 p.m. OK GNU C++14 TESTS 16 109 819200
190608391 Leasier B Jan. 26, 2023, 3:50 a.m. OK GNU C++14 TESTS 16 109 1536000
190604429 chy12321 B Jan. 26, 2023, 2:11 a.m. OK GNU C++14 TESTS 16 109 2457600
190601607 dictionary B Jan. 26, 2023, 12:40 a.m. OK GNU C++14 TESTS 16 109 2457600
190609952 WellWhale B Jan. 26, 2023, 4:21 a.m. OK GNU C++14 TESTS 16 109 8806400
190613601 girei B Jan. 26, 2023, 5:22 a.m. OK GNU C++14 TESTS 16 124 819200
190608106 CCaier B Jan. 26, 2023, 3:43 a.m. OK GNU C++14 TESTS 16 124 819200
190595924 genius_koder B Jan. 25, 2023, 9:47 p.m. OK GNU C++14 TESTS 16 124 819200
190590962 HitmanX97 B Jan. 25, 2023, 8:20 p.m. OK GNU C++14 TESTS 16 124 819200
190553471 onteeae B Jan. 25, 2023, 3:57 p.m. OK GNU C++17 TESTS 16 93 6041600
190554518 MouayadL7 B Jan. 25, 2023, 4 p.m. OK GNU C++17 TESTS 16 109 819200
190576361 Cflifu B Jan. 25, 2023, 5:53 p.m. OK GNU C++17 TESTS 16 109 819200
190606613 _Ifty_ B Jan. 26, 2023, 3:06 a.m. OK GNU C++17 TESTS 16 109 819200
190608438 HTTi B Jan. 26, 2023, 3:50 a.m. OK GNU C++17 TESTS 16 109 819200
190558029 _illogical_ B Jan. 25, 2023, 4:10 p.m. OK GNU C++17 TESTS 16 109 1638400
190552227 SegFaultError B Jan. 25, 2023, 3:54 p.m. OK GNU C++17 TESTS 16 109 2457600
190608711 ridnik B Jan. 26, 2023, 3:57 a.m. OK GNU C++17 TESTS 16 124 819200
190615295 wwawwaww B Jan. 26, 2023, 5:47 a.m. OK GNU C++17 TESTS 16 124 819200
190612894 10000h B Jan. 26, 2023, 5:10 a.m. OK GNU C++17 TESTS 16 124 819200
190577031 SaifullahMnsur B Jan. 25, 2023, 5:58 p.m. OK GNU C++17 (64) TESTS 16 93 1638400
190552568 DividedByZero_ B Jan. 25, 2023, 3:55 p.m. OK GNU C++17 (64) TESTS 16 93 1638400
190547900 sahibsingh139 B Jan. 25, 2023, 3:44 p.m. OK GNU C++17 (64) TESTS 16 93 3174400
190578425 tanmayArora14 B Jan. 25, 2023, 6:08 p.m. OK GNU C++17 (64) TESTS 16 93 3174400
190576112 pritish_001 B Jan. 25, 2023, 5:52 p.m. OK GNU C++17 (64) TESTS 16 93 3174400
190562328 kk_d B Jan. 25, 2023, 4:23 p.m. OK GNU C++17 (64) TESTS 16 93 3174400
190547403 codebering B Jan. 25, 2023, 3:43 p.m. OK GNU C++17 (64) TESTS 16 93 3174400
190561842 Salman__Ahmed B Jan. 25, 2023, 4:21 p.m. OK GNU C++17 (64) TESTS 16 93 3993600
190586715 lukameladze1 B Jan. 25, 2023, 7:25 p.m. OK GNU C++17 (64) TESTS 16 93 4812800
190577815 tutatitu B Jan. 25, 2023, 6:03 p.m. OK GNU C++17 (64) TESTS 16 93 5222400
190564988 maspy B Jan. 25, 2023, 4:32 p.m. OK GNU C++20 (64) TESTS 16 31 3276800
190614226 jiangly B Jan. 26, 2023, 5:31 a.m. OK GNU C++20 (64) TESTS 16 46 819200
190603392 Muhammad_Aneeq B Jan. 26, 2023, 1:41 a.m. OK GNU C++20 (64) TESTS 16 46 819200
190586084 A.Hazem_2003 B Jan. 25, 2023, 7:18 p.m. OK GNU C++20 (64) TESTS 16 46 1638400
190554599 GangMaster_ B Jan. 25, 2023, 4 p.m. OK GNU C++20 (64) TESTS 16 46 1638400
190604703 bigJ B Jan. 26, 2023, 2:18 a.m. OK GNU C++20 (64) TESTS 16 46 1638400
190577374 pastilia B Jan. 25, 2023, 6 p.m. OK GNU C++20 (64) TESTS 16 46 3174400
190570325 CtrlAltDelirium B Jan. 25, 2023, 5:16 p.m. OK GNU C++20 (64) TESTS 16 46 3174400
190556681 PUFL B Jan. 25, 2023, 4:06 p.m. OK GNU C++20 (64) TESTS 16 61 819200
190612802 IStillRe B Jan. 26, 2023, 5:09 a.m. OK GNU C++20 (64) TESTS 16 61 1638400
190570846 foolcoder B Jan. 25, 2023, 5:19 p.m. OK Java 11 TESTS 16 280 0
190569118 Lior B Jan. 25, 2023, 5:10 p.m. OK Java 11 TESTS 16 280 0
190587655 amanpatel23 B Jan. 25, 2023, 7:35 p.m. OK Java 11 TESTS 16 311 3174400
190588522 hsng299 B Jan. 25, 2023, 7:46 p.m. OK Java 11 TESTS 16 312 3891200
190552098 dzhi B Jan. 25, 2023, 3:54 p.m. OK Java 11 TESTS 16 327 3993600
190580814 princeayush04 B Jan. 25, 2023, 6:26 p.m. OK Java 11 TESTS 16 327 4096000
190565119 gk_cool B Jan. 25, 2023, 4:32 p.m. OK Java 11 TESTS 16 342 3072000
190562051 Rachit_3850 B Jan. 25, 2023, 4:22 p.m. OK Java 11 TESTS 16 342 3993600
190604849 wantu B Jan. 26, 2023, 2:22 a.m. OK Java 11 TESTS 16 343 4096000
190553458 kritikmodi B Jan. 25, 2023, 3:57 p.m. OK Java 11 TESTS 16 358 5120000
190553416 Badass_Nemesis B Jan. 25, 2023, 3:57 p.m. OK Java 17 TESTS 16 248 409600
190550413 Utsav82 B Jan. 25, 2023, 3:49 p.m. OK Java 17 TESTS 16 265 409600
190554472 anubh4v B Jan. 25, 2023, 4 p.m. OK Java 17 TESTS 16 295 3379200
190611290 yyr2233 B Jan. 26, 2023, 4:44 a.m. OK Java 17 TESTS 16 326 4403200
190549884 john9999911 B Jan. 25, 2023, 3:48 p.m. OK Java 17 TESTS 16 327 512000
190587495 arpurush B Jan. 25, 2023, 7:33 p.m. OK Java 17 TESTS 16 327 3584000
190559979 tbs-jyy B Jan. 25, 2023, 4:15 p.m. OK Java 17 TESTS 16 343 3379200
190600611 harryzhengipsum B Jan. 26, 2023, 12:04 a.m. OK Java 17 TESTS 16 358 5529600
190587223 jaredgrossthe B Jan. 25, 2023, 7:30 p.m. OK Java 17 TESTS 16 358 6758400
190556835 shubhanshu_jha14 B Jan. 25, 2023, 4:06 p.m. OK Java 17 TESTS 16 420 23142400
190604231 tong96 B Jan. 26, 2023, 2:06 a.m. OK Java 8 TESTS 16 187 0
190569850 yadavDipesh B Jan. 25, 2023, 5:13 p.m. OK Java 8 TESTS 16 233 11366400
190549196 vaibhavgawad B Jan. 25, 2023, 3:47 p.m. OK Java 8 TESTS 16 234 0
190598678 TheGoldenSmileOfTheNile B Jan. 25, 2023, 10:58 p.m. OK Java 8 TESTS 16 234 11161600
190580460 koolkartik B Jan. 25, 2023, 6:24 p.m. OK Java 8 TESTS 16 249 14643200
190565877 Akarsh2810 B Jan. 25, 2023, 4:34 p.m. OK Java 8 TESTS 16 264 11059200
190615625 tejasS-27 B Jan. 26, 2023, 5:51 a.m. OK Java 8 TESTS 16 264 11878400
190552957 depurador_ik B Jan. 25, 2023, 3:56 p.m. OK Java 8 TESTS 16 280 11264000
190548920 alikhan_emes B Jan. 25, 2023, 3:46 p.m. OK Java 8 TESTS 16 311 11161600
190555809 Ahmad_Hoseiny B Jan. 25, 2023, 4:03 p.m. OK Java 8 TESTS 16 311 15360000
190591416 shorya1835 B Jan. 25, 2023, 8:27 p.m. OK MS C++ 2017 TESTS 16 264 3276800
190551423 maxK99 B Jan. 25, 2023, 3:52 p.m. OK MS C++ 2017 TESTS 16 265 1638400
190551158 Ahmed_Ashraf_f B Jan. 25, 2023, 3:51 p.m. OK MS C++ 2017 TESTS 16 296 1638400
190547835 KeFu B Jan. 25, 2023, 3:44 p.m. OK MS C++ 2017 TESTS 16 296 2252800
190611984 _2dvector B Jan. 26, 2023, 4:55 a.m. OK MS C++ 2017 TESTS 16 312 1740800
190554275 adesh123 B Jan. 25, 2023, 3:59 p.m. OK MS C++ 2017 TESTS 16 312 4812800
190553205 alsrb0504 B Jan. 25, 2023, 3:56 p.m. OK Node.js TESTS 16 217 26931200
190576424 grawlixes B Jan. 25, 2023, 5:54 p.m. OK PyPy 3 TESTS 16 249 21094400
190555692 bvf B Jan. 25, 2023, 4:03 p.m. OK PyPy 3 TESTS 16 265 19968000
190578833 ankitesh B Jan. 25, 2023, 6:11 p.m. OK PyPy 3 TESTS 16 404 19046400
190572605 l_a_l_u1234 B Jan. 25, 2023, 5:29 p.m. OK PyPy 3 TESTS 16 421 24268800
190556611 star-1ord B Jan. 25, 2023, 4:06 p.m. OK PyPy 3 TESTS 16 451 19046400
190553619 YouMust B Jan. 25, 2023, 3:57 p.m. OK PyPy 3 TESTS 16 467 19558400
190556476 A9_10 B Jan. 25, 2023, 4:05 p.m. OK PyPy 3 TESTS 16 468 19046400
190564605 AhsanHabib B Jan. 25, 2023, 4:31 p.m. OK PyPy 3 TESTS 16 483 25395200
190569810 JUBHAI B Jan. 25, 2023, 5:13 p.m. OK PyPy 3 TESTS 16 529 32051200
190553169 AKS_95461 B Jan. 25, 2023, 3:56 p.m. OK PyPy 3 TESTS 16 530 33177600
190589099 poornaTheja B Jan. 25, 2023, 7:53 p.m. OK PyPy 3-64 TESTS 16 155 22220800
190584535 Pronoy_Deb B Jan. 25, 2023, 7:01 p.m. OK PyPy 3-64 TESTS 16 155 24473600
190573818 this.is.real B Jan. 25, 2023, 5:37 p.m. OK PyPy 3-64 TESTS 16 155 27545600
190604965 InariInDream B Jan. 26, 2023, 2:26 a.m. OK PyPy 3-64 TESTS 16 155 27955200
190604238 crapcode B Jan. 26, 2023, 2:06 a.m. OK PyPy 3-64 TESTS 16 155 30515200
190561237 rishabh.jaiswal B Jan. 25, 2023, 4:19 p.m. OK PyPy 3-64 TESTS 16 155 31948800
190576523 gardengnome B Jan. 25, 2023, 5:54 p.m. OK PyPy 3-64 TESTS 16 170 27545600
190588725 Khaild_Salman B Jan. 25, 2023, 7:48 p.m. OK PyPy 3-64 TESTS 16 171 26214400
190564568 anshumannandan B Jan. 25, 2023, 4:30 p.m. OK PyPy 3-64 TESTS 16 171 27545600
190614245 SophieHatter B Jan. 26, 2023, 5:31 a.m. OK PyPy 3-64 TESTS 16 171 28364800
190554505 DonC B Jan. 25, 2023, 4 p.m. OK Python 3 TESTS 16 280 17305600
190614049 sum_it. B Jan. 26, 2023, 5:28 a.m. OK Python 3 TESTS 16 280 18022400
190553442 shreyansh1503 B Jan. 25, 2023, 3:57 p.m. OK Python 3 TESTS 16 280 18022400
190603632 M-ANEEQ B Jan. 26, 2023, 1:47 a.m. OK Python 3 TESTS 16 280 19660800
190592058 eugalt B Jan. 25, 2023, 8:36 p.m. OK Python 3 TESTS 16 280 19660800
190615519 xgyx B Jan. 26, 2023, 5:50 a.m. OK Python 3 TESTS 16 295 17612800
190603761 M-ANEEQ B Jan. 26, 2023, 1:51 a.m. OK Python 3 TESTS 16 295 19660800
190589131 sagar.sachan.eee21 B Jan. 25, 2023, 7:54 p.m. OK Python 3 TESTS 16 296 18022400
190554040 elephant_trap B Jan. 25, 2023, 3:58 p.m. OK Python 3 TESTS 16 296 18022400
190610763 kunal2k86 B Jan. 26, 2023, 4:35 a.m. OK Python 3 TESTS 16 296 19660800

remove filters

Back to search problems