Codeforces Round 768 (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
1630 Codeforces Round 768 (Div. 1) FINISHED False 7200 88529099 Jan. 27, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 5795 ) B Range and Partition PROGRAMMING binary search data structures greedy two pointers

B'Given an array a of n integers, find a range of values [x, y] ( x <= y ), and split a into exactly k ( 1 <= k <= n ) subarrays in such a way that: Print any solution that minimizes y - x . The input consists of multiple test cases. The first line contains a single integer t ( 1 <= q t <= q 3 cdot 10^4 ) -- the number of test cases. Description of the test cases follows. The first line of each test case contains two integers n and k ( 1 <= k <= n <= 2 cdot 10^5 ) -- the length of the array a and the number of subarrays required in the partition. The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= n ) where a_i is the i -th element of the array. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot10^5 . For each test case, print k+1 lines. In the first line, print x and y -- the limits of the found range. Then print k lines, the i -th should contain l_i and r_i ( 1 <= q l_i <= q r_i <= q n ) -- the limits of the i -th subarray. You can print the subarrays in any order. In the first test, there should be only one subarray, which must be equal to the whole array. There are 2 elements inside the range [1, 2] and 0 elements outside, if the chosen range is [1, 1] , there will be 1 element inside ( a_1 ) and 1 element outside ( a_2 ), and the answer will be invalid. In the second test, it is possible to choose the range [2, 2] , and split the array in subarrays (1, 3) and (4, 4) , in subarray (1, 3) there are 2 elements inside the range ( a_2 and a_3 ) and 1 element outside ( a_1 ), in subarray (4, 4) there is only 1 element ( a_4 ), and it is inside the range. In the third test, it is possible to choose the range [5, 5]$'...

Tutorials

Editorial of Codeforces Round #768

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
144190492 Gassa B Jan. 27, 2022, 2:57 p.m. OK D TESTS 39 280 24371200
144216411 Sigma-Sagittarius B Jan. 27, 2022, 3:32 p.m. OK FPC TESTS 39 249 12492800
144236179 TanKuku B Jan. 27, 2022, 4:09 p.m. OK GNU C++14 TESTS 39 31 16384000
144205562 jiuruifu B Jan. 27, 2022, 3:16 p.m. OK GNU C++14 TESTS 39 78 2355200
144187460 dlalswp25 B Jan. 27, 2022, 2:54 p.m. OK GNU C++14 TESTS 39 93 1638400
144217157 yycdxp B Jan. 27, 2022, 3:33 p.m. OK GNU C++14 TESTS 39 93 1638400
144202046 praying_cqf B Jan. 27, 2022, 3:11 p.m. OK GNU C++14 TESTS 39 93 1638400
144224514 Yeori B Jan. 27, 2022, 3:46 p.m. OK GNU C++14 TESTS 39 93 2457600
144205405 retcarizy B Jan. 27, 2022, 3:16 p.m. OK GNU C++14 TESTS 39 93 3174400
144230214 Qing_LKYi B Jan. 27, 2022, 3:57 p.m. OK GNU C++14 TESTS 39 93 3174400
144202623 700YKSEULB B Jan. 27, 2022, 3:12 p.m. OK GNU C++14 TESTS 39 93 3174400
144200008 F1aMiR3 B Jan. 27, 2022, 3:09 p.m. OK GNU C++14 TESTS 39 108 1536000
144199928 fallleaves01 B Jan. 27, 2022, 3:08 p.m. OK GNU C++17 TESTS 39 62 1638400
144197277 Everule B Jan. 27, 2022, 3:05 p.m. OK GNU C++17 TESTS 39 93 1638400
144255204 aksayush B Jan. 27, 2022, 6:39 p.m. OK GNU C++17 TESTS 39 93 1638400
144231931 magga B Jan. 27, 2022, 4 p.m. OK GNU C++17 TESTS 39 93 1638400
144213861 Mr.Krabs B Jan. 27, 2022, 3:28 p.m. OK GNU C++17 TESTS 39 93 1638400
144211676 danielykf B Jan. 27, 2022, 3:24 p.m. OK GNU C++17 TESTS 39 93 1638400
144207392 ivandasfs B Jan. 27, 2022, 3:18 p.m. OK GNU C++17 TESTS 39 93 1638400
144190981 ccf_n0i B Jan. 27, 2022, 2:58 p.m. OK GNU C++17 TESTS 39 93 1843200
144208621 nonamefour0210 B Jan. 27, 2022, 3:20 p.m. OK GNU C++17 TESTS 39 93 2457600
144228059 WillTheBill B Jan. 27, 2022, 3:53 p.m. OK GNU C++17 TESTS 39 93 10342400
144190041 QAQAutoMaton B Jan. 27, 2022, 2:57 p.m. OK GNU C++17 (64) TESTS 39 31 11468800
144209340 CE_WA_TLE B Jan. 27, 2022, 3:21 p.m. OK GNU C++17 (64) TESTS 39 31 22323200
144208007 emthrm B Jan. 27, 2022, 3:19 p.m. OK GNU C++17 (64) TESTS 39 77 1638400
144280724 kitsune B Jan. 28, 2022, 4:44 a.m. OK GNU C++17 (64) TESTS 39 77 1638400
144207614 dfcmd B Jan. 27, 2022, 3:18 p.m. OK GNU C++17 (64) TESTS 39 77 1638400
144193374 Andreasyan B Jan. 27, 2022, 3:01 p.m. OK GNU C++17 (64) TESTS 39 77 2457600
144197759 MAOoo_Love_Molly B Jan. 27, 2022, 3:06 p.m. OK GNU C++17 (64) TESTS 39 77 2457600
144196940 xyf0076 B Jan. 27, 2022, 3:05 p.m. OK GNU C++17 (64) TESTS 39 77 3174400
144181268 SSRS_ B Jan. 27, 2022, 2:48 p.m. OK GNU C++17 (64) TESTS 39 77 3276800
144262688 lukameladze1 B Jan. 27, 2022, 8:14 p.m. OK GNU C++17 (64) TESTS 39 77 3584000
144206203 Alphagocc B Jan. 27, 2022, 3:17 p.m. OK GNU C++20 (64) TESTS 39 31 7884800
144199005 maspy B Jan. 27, 2022, 3:07 p.m. OK GNU C++20 (64) TESTS 39 31 8908800
144212787 czhang2718 B Jan. 27, 2022, 3:26 p.m. OK GNU C++20 (64) TESTS 39 61 1638400
144242597 SanguineChameleon B Jan. 27, 2022, 4:23 p.m. OK GNU C++20 (64) TESTS 39 61 1638400
144225085 generic_placeholder_name B Jan. 27, 2022, 3:47 p.m. OK GNU C++20 (64) TESTS 39 61 1638400
144224343 gxy001 B Jan. 27, 2022, 3:45 p.m. OK GNU C++20 (64) TESTS 39 61 1638400
144196426 A_G B Jan. 27, 2022, 3:04 p.m. OK GNU C++20 (64) TESTS 39 61 1638400
144188087 dorijanlendvaj B Jan. 27, 2022, 2:55 p.m. OK GNU C++20 (64) TESTS 39 61 2457600
144241538 magnus.hegdahl B Jan. 27, 2022, 4:21 p.m. OK GNU C++20 (64) TESTS 39 61 5836800
144194518 ALILILILILI-KHAN B Jan. 27, 2022, 3:02 p.m. OK GNU C++20 (64) TESTS 39 61 5836800
144210682 anvorguesa B Jan. 27, 2022, 3:23 p.m. OK Go TESTS 39 202 7884800
144207613 0x3F B Jan. 27, 2022, 3:18 p.m. OK Go TESTS 39 202 14131200
144203993 clyring B Jan. 27, 2022, 3:14 p.m. OK Haskell TESTS 39 514 38912000
144218985 derrick20 B Jan. 27, 2022, 3:36 p.m. OK Java 11 TESTS 39 264 0
144224965 martins B Jan. 27, 2022, 3:47 p.m. OK Java 11 TESTS 39 327 7372800
144234007 saptarshi1729 B Jan. 27, 2022, 4:04 p.m. OK Java 11 TESTS 39 327 23244800
144256844 Mathematiker B Jan. 27, 2022, 6:53 p.m. OK Java 11 TESTS 39 342 0
144221759 Mathematiker B Jan. 27, 2022, 3:41 p.m. OK Java 11 TESTS 39 1746 0
144208441 fetetriste B Jan. 27, 2022, 3:20 p.m. OK Java 8 TESTS 39 187 2457600
144219855 MagentaCobra B Jan. 27, 2022, 3:38 p.m. OK Java 8 TESTS 39 202 12390400
144244235 iakovlev.zakhar B Jan. 27, 2022, 4:27 p.m. OK Java 8 TESTS 39 218 2048000
144208609 SecondThread B Jan. 27, 2022, 3:20 p.m. OK Java 8 TESTS 39 218 38297600
144216375 AdhmMohamed B Jan. 27, 2022, 3:32 p.m. OK Java 8 TESTS 39 264 3276800
144207136 YahiaSherif B Jan. 27, 2022, 3:18 p.m. OK Java 8 TESTS 39 265 5529600
144263580 ak_ankit B Jan. 27, 2022, 8:31 p.m. OK Java 8 TESTS 39 1279 2252800
144285671 AS_1729 B Jan. 28, 2022, 5:52 a.m. OK Java 8 TESTS 39 1528 41472000
144229518 Sparky_Master_WCH1226 B Jan. 27, 2022, 3:55 p.m. OK Kotlin 1.4 TESTS 39 171 0
144208162 Hakiobo B Jan. 27, 2022, 3:19 p.m. OK Kotlin 1.4 TESTS 39 280 16384000
144195607 ComPhyPark B Jan. 27, 2022, 3:03 p.m. OK MS C++ 2017 TESTS 39 686 4096000
144221489 grey B Jan. 27, 2022, 3:41 p.m. OK MS C++ 2017 TESTS 39 1154 9216000
144222320 mban259 B Jan. 27, 2022, 3:42 p.m. OK .NET Core C# TESTS 39 327 45363200
144218025 misorin B Jan. 27, 2022, 3:35 p.m. OK PyPy 3 TESTS 39 358 33894400
144204536 FlakeLCR B Jan. 27, 2022, 3:14 p.m. OK PyPy 3 TESTS 39 373 31129600
144188442 conqueror_of_tourist B Jan. 27, 2022, 2:55 p.m. OK PyPy 3 TESTS 39 468 31641600
144209627 SPD_9X2 B Jan. 27, 2022, 3:22 p.m. OK PyPy 3 TESTS 39 483 33689600
144242320 NecroSean38 B Jan. 27, 2022, 4:23 p.m. OK PyPy 3 TESTS 39 545 24473600
144232477 eepsilon B Jan. 27, 2022, 4:01 p.m. OK PyPy 3 TESTS 39 623 20275200
144212231 titia B Jan. 27, 2022, 3:25 p.m. OK PyPy 3 TESTS 39 639 20070400
144195427 whatshisbucket B Jan. 27, 2022, 3:03 p.m. OK PyPy 3 TESTS 39 670 20582400
144233817 MathisHammel B Jan. 27, 2022, 4:04 p.m. OK PyPy 3 TESTS 39 1294 22220800
144219440 plevande B Jan. 27, 2022, 3:37 p.m. OK PyPy 3-64 TESTS 39 482 34713600
144191935 asdsasd B Jan. 27, 2022, 2:59 p.m. OK PyPy 3-64 TESTS 39 655 31436800
144207708 Slamur B Jan. 27, 2022, 3:19 p.m. OK PyPy 3-64 TESTS 39 889 43212800
144260454 OLOGY B Jan. 27, 2022, 7:37 p.m. OK Python 2 TESTS 39 499 30617600
144260544 OLOGY B Jan. 27, 2022, 7:38 p.m. OK Python 2 TESTS 39 514 30515200
144192343 sansen B Jan. 27, 2022, 2:59 p.m. OK Rust 2021 TESTS 39 46 11878400
144194144 Egor B Jan. 27, 2022, 3:01 p.m. OK Rust 2021 TESTS 39 61 3174400
144258376 orz_liuwei B Jan. 27, 2022, 7:10 p.m. OK Rust 2021 TESTS 39 1637 6860800

remove filters

Back to search problems