Codeforces Round 936 (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
1946 Codeforces Round 936 (Div. 2) FINISHED False 7200 20705099 March 22, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 20534 ) B Maximum Sum PROGRAMMING greedy math

B'You have an array a of n integers. You perform exactly k operations on it. In one operation, you select any contiguous subarray of the array a (possibly empty) and insert the sum of this subarray anywhere in the array. Your task is to find the maximum possible sum of the array after k such operations. As this number can be very large, output the answer modulo 10^9 + 7 . Reminder: the remainder of a number x modulo p is the smallest non-negative y such that there exists an integer q and x = p cdot q + y . Each test consists of several test cases. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Then follows the description of the test cases. The first line of each test case contains two integers n and k ( 1 <= n, k <= 2 cdot 10^5 ) -- the length of the array a and the number of operations, respectively. The second line of each test case contains n integers a_1, a_2, ldots, a_n ( -10^9 <= a_i <= 10^9 ) -- the array a itself. It is guaranteed that the sum of the values of n and k for all test cases does not exceed 2 cdot 10^5 . For each test, output a single integer -- the maximum sum of the array that can be obtained after k operations modulo 10^9 + 7 . In the first test case, it is advantageous to take an empty subarray of the array twice and insert the sum of the empty subarray (zero) anywhere, then the sum of the resulting array will be (-4) + (-7) + 0 + 0 = -11 , modulo 10^9 + 7 this is 999 ,999 ,996 . In the second test case, it is advantageous to take the sum of the entire array three times and place it anywhere in the array, then one of the possible sequences of actions: [ 2, 2, 8 ] rightarrow [ 2, 2, 8, 12 ] rightarrow [ 2, 2, 8, 12, 24 ] rightarrow [ 2, 2, 8, 12, 24, 48 ], the sum of the final a'...

Tutorials

Codeforces Round #936 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
252828920 Arnyev B March 22, 2024, 8:04 p.m. OK C# 10 TESTS 14 108 27545600
252852387 chrisTris B March 23, 2024, 2:23 a.m. OK C# 10 TESTS 14 109 17612800
252850023 karamkontar B March 23, 2024, 1:43 a.m. OK C# 10 TESTS 14 155 34508800
252850171 karamkontar B March 23, 2024, 1:46 a.m. OK C# 10 TESTS 14 218 41779200
252850601 K.zimingL B March 23, 2024, 1:54 a.m. OK C++14 (GCC 6-32) TESTS 14 62 819200
252849330 xyw_6 B March 23, 2024, 1:29 a.m. OK C++14 (GCC 6-32) TESTS 14 62 819200
252847887 hxdxiaoming B March 23, 2024, 12:58 a.m. OK C++14 (GCC 6-32) TESTS 14 62 1638400
252846803 domferrel B March 23, 2024, 12:35 a.m. OK C++14 (GCC 6-32) TESTS 14 62 1638400
252840644 Jaydatt. B March 22, 2024, 10:30 p.m. OK C++14 (GCC 6-32) TESTS 14 62 1638400
252870050 yeshuchen LiWenX xcc_szy09051 B March 23, 2024, 5:54 a.m. OK C++14 (GCC 6-32) TESTS 14 62 1638400
252862354 yuzou B March 23, 2024, 4:41 a.m. OK C++14 (GCC 6-32) TESTS 14 62 1638400
252862163 yuzou B March 23, 2024, 4:38 a.m. OK C++14 (GCC 6-32) TESTS 14 62 1638400
252853921 acmgod B March 23, 2024, 2:46 a.m. OK C++14 (GCC 6-32) TESTS 14 62 1638400
252850358 K.zimingL B March 23, 2024, 1:49 a.m. OK C++14 (GCC 6-32) TESTS 14 62 1638400
252859463 Actium B March 23, 2024, 3:58 a.m. OK C++17 (GCC 7-32) TESTS 14 61 819200
252814458 AAli963 B March 22, 2024, 5:44 p.m. OK C++17 (GCC 7-32) TESTS 14 62 0
252863623 FFFishmaker B March 23, 2024, 4:57 a.m. OK C++17 (GCC 7-32) TESTS 14 62 0
252845451 hhhyh B March 23, 2024, 12:06 a.m. OK C++17 (GCC 7-32) TESTS 14 62 0
252845315 Ahmed_Aladdin B March 23, 2024, 12:03 a.m. OK C++17 (GCC 7-32) TESTS 14 62 0
252822998 ZoTH B March 22, 2024, 7:02 p.m. OK C++17 (GCC 7-32) TESTS 14 62 0
252820184 imsTusker B March 22, 2024, 6:33 p.m. OK C++17 (GCC 7-32) TESTS 14 62 0
252812189 SCF_01 B March 22, 2024, 5:29 p.m. OK C++17 (GCC 7-32) TESTS 14 62 0
252867291 simona1230 B March 23, 2024, 5:32 a.m. OK C++17 (GCC 7-32) TESTS 14 62 819200
252859990 ChewieMewK B March 23, 2024, 4:05 a.m. OK C++17 (GCC 7-32) TESTS 14 62 819200
252849129 Kiffaz B March 23, 2024, 1:25 a.m. OK C++20 (GCC 13-64) TESTS 14 30 1126400
252810639 Toufik B March 22, 2024, 5:22 p.m. OK C++20 (GCC 13-64) TESTS 14 31 819200
252857355 Chentxo B March 23, 2024, 3:32 a.m. OK C++20 (GCC 13-64) TESTS 14 31 819200
252835119 Vengxeance B March 22, 2024, 9:12 p.m. OK C++20 (GCC 13-64) TESTS 14 31 819200
252851488 Airths B March 23, 2024, 2:09 a.m. OK C++20 (GCC 13-64) TESTS 14 31 1638400
252835471 Mysterious109 B March 22, 2024, 9:16 p.m. OK C++20 (GCC 13-64) TESTS 14 31 1638400
252828169 target_candidate_master B March 22, 2024, 7:56 p.m. OK C++20 (GCC 13-64) TESTS 14 31 1638400
252834343 Satinii B March 22, 2024, 9:03 p.m. OK C++20 (GCC 13-64) TESTS 14 31 1638400
252863176 dremlory B March 23, 2024, 4:51 a.m. OK C++20 (GCC 13-64) TESTS 14 31 1638400
252851940 pingpongdragon B March 23, 2024, 2:17 a.m. OK C++20 (GCC 13-64) TESTS 14 31 1638400
252860823 bluemegane B March 23, 2024, 4:18 a.m. OK C# 8 TESTS 14 202 18636800
252818662 jayanth26 B March 22, 2024, 6:19 p.m. OK GNU C11 TESTS 14 78 3481600
252824042 nguyenquocthao00 B March 22, 2024, 7:12 p.m. OK Go TESTS 14 61 13721600
252838127 crapcode B March 22, 2024, 9:51 p.m. OK Go TESTS 14 124 4710400
252864117 E.M.T. B March 23, 2024, 5:03 a.m. OK Go TESTS 14 124 4812800
252863426 E.M.T. B March 23, 2024, 4:54 a.m. OK Go TESTS 14 124 4812800
252858211 webmin B March 23, 2024, 3:43 a.m. OK Go TESTS 14 139 4710400
252800760 gaju_01 B March 22, 2024, 4:19 p.m. OK Java 21 TESTS 14 264 0
252866286 priyaroy3370 B March 23, 2024, 5:24 a.m. OK Java 21 TESTS 14 264 14336000
252834339 Jagnath_Reddy B March 22, 2024, 9:03 p.m. OK Java 21 TESTS 14 311 0
252805758 ProjectYoung B March 22, 2024, 4:33 p.m. OK Java 21 TESTS 14 311 1638400
252849899 Festyve B March 23, 2024, 1:40 a.m. OK Java 21 TESTS 14 312 0
252832325 Jagnath_Reddy B March 22, 2024, 8:39 p.m. OK Java 21 TESTS 14 326 307200
252816717 fabiowg B March 22, 2024, 6:02 p.m. OK Java 21 TESTS 14 326 307200
252833958 thebrogrammer B March 22, 2024, 8:58 p.m. OK Java 21 TESTS 14 327 512000
252842875 Sagy13 B March 22, 2024, 11:14 p.m. OK Java 21 TESTS 14 327 1126400
252833908 Jagnath_Reddy B March 22, 2024, 8:58 p.m. OK Java 21 TESTS 14 342 0
252812107 alifahmy1 B March 22, 2024, 5:29 p.m. OK Java 8 TESTS 14 155 2764800
252800472 samy10127 B March 22, 2024, 4:19 p.m. OK Java 8 TESTS 14 155 2764800
252829302 wbeard01 B March 22, 2024, 8:08 p.m. OK Java 8 TESTS 14 155 3174400
252804299 Xing_ke B March 22, 2024, 4:29 p.m. OK Java 8 TESTS 14 186 2969600
252815474 samy10127 B March 22, 2024, 5:52 p.m. OK Java 8 TESTS 14 202 2764800
252818831 formidablechief27 B March 22, 2024, 6:21 p.m. OK Java 8 TESTS 14 202 79769600
252817012 chaitanya1023 B March 22, 2024, 6:05 p.m. OK Java 8 TESTS 14 405 0
252839001 upindiasarvesh B March 22, 2024, 10:03 p.m. OK Java 8 TESTS 14 420 0
252856743 AdityaVxts B March 23, 2024, 3:24 a.m. OK Java 8 TESTS 14 436 0
252801545 Maheshwari_Saksham B March 22, 2024, 4:22 p.m. OK Java 8 TESTS 14 467 0
252831437 moart B March 22, 2024, 8:30 p.m. OK Kotlin 1.9 TESTS 14 265 17817600
252804468 pavelk108 B March 22, 2024, 4:30 p.m. OK Kotlin 1.9 TESTS 14 498 1126400
252815493 Salamander_ B March 22, 2024, 5:52 p.m. OK Node.js TESTS 14 280 49971200
252811602 swapnil_diganta B March 22, 2024, 5:26 p.m. OK PHP TESTS 14 202 31539200
252814413 logankeede B March 22, 2024, 5:44 p.m. OK PyPy 3 TESTS 14 358 17510400
252863028 7JJJXFV9_XC B March 23, 2024, 4:49 a.m. OK PyPy 3 TESTS 14 374 17203200
252805251 SisJ16 B March 22, 2024, 4:31 p.m. OK PyPy 3 TESTS 14 560 17612800
252869499 migi_03 B March 23, 2024, 5:50 a.m. OK PyPy 3 TESTS 14 561 17305600
252801382 jeet_2021 B March 22, 2024, 4:21 p.m. OK PyPy 3 TESTS 14 561 17510400
252821301 EvGen1u5 B March 22, 2024, 6:44 p.m. OK PyPy 3 TESTS 14 592 16998400
252819350 gryphon B March 22, 2024, 6:26 p.m. OK PyPy 3 TESTS 14 592 17612800
252801414 pavanmanishd B March 22, 2024, 4:21 p.m. OK PyPy 3 TESTS 14 592 17612800
252804451 2210030210 B March 22, 2024, 4:30 p.m. OK PyPy 3 TESTS 14 623 16998400
252863347 vovesi4341 B March 23, 2024, 4:53 a.m. OK PyPy 3 TESTS 14 655 17612800
252831057 McPqndq B March 22, 2024, 8:26 p.m. OK PyPy 3-64 TESTS 14 109 26828800
252817987 yertugan06 B March 22, 2024, 6:13 p.m. OK PyPy 3-64 TESTS 14 109 26828800
252863331 tanmay1610 B March 23, 2024, 4:53 a.m. OK PyPy 3-64 TESTS 14 124 26624000
252818591 yertugan06 B March 22, 2024, 6:19 p.m. OK PyPy 3-64 TESTS 14 124 26931200
252801548 Essi B March 22, 2024, 4:22 p.m. OK PyPy 3-64 TESTS 14 124 28569600
252863635 myf07 B March 23, 2024, 4:57 a.m. OK PyPy 3-64 TESTS 14 124 30515200
252825094 Pronoy_Deb B March 22, 2024, 7:23 p.m. OK PyPy 3-64 TESTS 14 139 26419200
252863280 tanmay1610 B March 23, 2024, 4:52 a.m. OK PyPy 3-64 TESTS 14 139 26624000
252863260 tanmay1610 B March 23, 2024, 4:52 a.m. OK PyPy 3-64 TESTS 14 139 26624000
252861988 GirirajParik_08 B March 23, 2024, 4:35 a.m. OK PyPy 3-64 TESTS 14 139 29081600
252809884 OLOGY B March 22, 2024, 5:19 p.m. OK Python 2 TESTS 14 280 13107200
252815470 OLOGY B March 22, 2024, 5:52 p.m. OK Python 2 TESTS 14 280 13209600
252832294 MTA9402 B March 22, 2024, 8:39 p.m. OK Python 3 TESTS 14 140 29491200
252860820 sekiro1 B March 23, 2024, 4:18 a.m. OK Python 3 TESTS 14 155 27238400
252838436 DebiecheAmine B March 22, 2024, 9:56 p.m. OK Python 3 TESTS 14 155 27238400
252816568 Aniket_001 B March 22, 2024, 6:01 p.m. OK Python 3 TESTS 14 155 28672000
252806019 malekbennacer5 B March 22, 2024, 4:33 p.m. OK Python 3 TESTS 14 155 28672000
252805484 rudrasravan B March 22, 2024, 4:32 p.m. OK Python 3 TESTS 14 155 28672000
252805129 prashantyadav09783 B March 22, 2024, 4:31 p.m. OK Python 3 TESTS 14 155 28672000
252805015 negative46 B March 22, 2024, 4:31 p.m. OK Python 3 TESTS 14 155 28672000
252800310 miss_X B March 22, 2024, 4:18 p.m. OK Python 3 TESTS 14 155 28672000
252863403 sekiro1 B March 23, 2024, 4:54 a.m. OK Python 3 TESTS 14 170 27238400
252824697 0x81 B March 22, 2024, 7:19 p.m. OK Ruby 3 TESTS 14 763 24678400
252805492 sabbirahmeds877 B March 22, 2024, 4:32 p.m. OK Ruby 3 TESTS 14 795 37273600
252831786 DreadedHippy B March 22, 2024, 8:34 p.m. OK Rust 2021 TESTS 14 62 7884800
252802849 paugh00001 B March 22, 2024, 4:25 p.m. OK Rust 2021 TESTS 14 77 7884800

remove filters

Back to search problems