Codeforces Round 893 (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
1858 Codeforces Round 893 (Div. 2) FINISHED False 7200 39713099 Aug. 15, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 2851 ) D Trees and Segments PROGRAMMING binary search brute force constructive algorithms data structures dp greedy two pointers 2200

B'The teachers of the Summer Informatics School decided to plant n trees in a row, and it was decided to plant only oaks and firs. To do this, they made a plan, which can be represented as a binary string s of length n . If s_i = 0 , then the i -th tree in the row should be an oak, and if s_i = 1 , then the i -th tree in the row should be a fir. The day of tree planting is tomorrow, and the day after tomorrow an inspector will come to the School. The inspector loves nature very much, and he will evaluate the beauty of the row as follows: The teachers know the value of the parameter a , but for security reasons they cannot tell it to you. They only told you that a is an integer from 1 to n . Since the trees have not yet been planted, the teachers decided to change the type of no more than k trees to the opposite (i.e., change s_i from 0 to 1 or from 1 to 0 in the plan) in order to maximize the beauty of the row of trees according to the inspector. For each integer j from 1 to n answer the following question independently: The first line contains a single integer t ( 1 <= t <= 1000 ) -- the number of test cases. The first line of each test case contains two integers n and k ( 1 <= n <= 3000 , 0 <= k <= n ) -- the number of trees in the row and the maximum number of changes. The second line contains a string s of length n , consisting of zeros and ones -- the plan description. It is guaranteed that the sum of all n values for all test cases does not exceed 3000 . For each test case, print n integers, the j -th ( 1 <= j <= n ) of which is the maximum beauty of the row of trees after no more than k changes if a = j is used to calculate the beauty. In the first test case no changes are allowed, so l_0 = 0 and l_1 = 3 always hold. Thus, regardless o'...

Tutorials

Codeforces Round #893 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
219030648 zltzlt D Aug. 15, 2023, 11:28 p.m. OK GNU C++14 TESTS 39 62 102400 2200
219030192 zltzlt D Aug. 15, 2023, 11:13 p.m. OK GNU C++14 TESTS 39 78 102400 2200
219044754 Aurora0915 D Aug. 16, 2023, 2:48 a.m. OK GNU C++14 TESTS 40 93 102400 2200
219036514 QZJ114514 D Aug. 16, 2023, 1:27 a.m. OK GNU C++14 TESTS 39 109 72396800 2200
218997151 StardustQ D Aug. 15, 2023, 4:31 p.m. OK GNU C++14 TESTS 39 109 72396800 2200
219034093 Leasier D Aug. 16, 2023, 12:47 a.m. OK GNU C++14 TESTS 39 109 72499200 2200
219048759 KevinLikesCoding D Aug. 16, 2023, 3:29 a.m. OK GNU C++14 TESTS 40 124 38092800 2200
219044350 luogu_bot2 D Aug. 16, 2023, 2:44 a.m. OK GNU C++14 TESTS 40 124 72396800 2200
219038899 HanghangHanghang D Aug. 16, 2023, 1:59 a.m. OK GNU C++14 TESTS 39 139 72294400 2200
219060616 matengsdu D Aug. 16, 2023, 5:54 a.m. OK GNU C++14 TESTS 40 139 72396800 2200
219050405 Sajjat004 D Aug. 16, 2023, 3:50 a.m. OK GNU C++17 TESTS 40 61 102400 2200
219022003 Md._Nahid_Ullah_Joy D Aug. 15, 2023, 8:15 p.m. OK GNU C++17 TESTS 39 78 102400 2200
219008036 xwb20021119 D Aug. 15, 2023, 5:43 p.m. OK GNU C++17 TESTS 39 92 72806400 2200
219009468 Stormersyle D Aug. 15, 2023, 5:55 p.m. OK GNU C++17 TESTS 39 109 72396800 2200
219019160 CardboardTank D Aug. 15, 2023, 7:37 p.m. OK GNU C++17 TESTS 39 124 38092800 2200
218998535 BenchPress D Aug. 15, 2023, 4:33 p.m. OK GNU C++17 TESTS 39 124 72294400 2200
219049433 Lihwy D Aug. 16, 2023, 3:37 a.m. OK GNU C++17 TESTS 40 124 72396800 2200
219003507 dysyn1413 D Aug. 15, 2023, 5:13 p.m. OK GNU C++17 TESTS 39 124 74649600 2200
219014342 Gurban D Aug. 15, 2023, 6:43 p.m. OK GNU C++17 TESTS 39 124 144793600 2200
219042615 HarperTaylor D Aug. 16, 2023, 2:28 a.m. OK GNU C++17 TESTS 40 139 36249600 2200
218999338 belphegor_ D Aug. 15, 2023, 4:34 p.m. OK GNU C++17 (64) TESTS 39 93 72396800 2200
219033271 Wuyanru D Aug. 16, 2023, 12:30 a.m. OK GNU C++17 (64) TESTS 39 108 144793600 2200
218997136 Vancezyx D Aug. 15, 2023, 4:31 p.m. OK GNU C++17 (64) TESTS 39 109 74240000 2200
218995075 PurpleCrayon D Aug. 15, 2023, 4:27 p.m. OK GNU C++17 (64) TESTS 39 124 36352000 2200
219053762 Cantor. D Aug. 16, 2023, 4:35 a.m. OK GNU C++17 (64) TESTS 40 155 112947200 2200
219049889 suomynonA D Aug. 16, 2023, 3:43 a.m. OK GNU C++17 (64) TESTS 40 156 108646400 2200
219040663 yyyyyd D Aug. 16, 2023, 2:15 a.m. OK GNU C++17 (64) TESTS 40 156 108953600 2200
219005313 BigTheta D Aug. 15, 2023, 5:23 p.m. OK GNU C++17 (64) TESTS 39 170 75571200 2200
219002930 liaokq D Aug. 15, 2023, 5:09 p.m. OK GNU C++17 (64) TESTS 39 170 145305600 2200
219047490 Ashlyn D Aug. 16, 2023, 3:13 a.m. OK GNU C++17 (64) TESTS 40 171 108953600 2200
219011636 bachbeo2007 D Aug. 15, 2023, 6:14 p.m. OK GNU C++20 (64) TESTS 39 62 72396800 2200
219008022 Luenly D Aug. 15, 2023, 5:43 p.m. OK GNU C++20 (64) TESTS 39 93 102400 2200
219043288 Maginy_ZYX D Aug. 16, 2023, 2:34 a.m. OK GNU C++20 (64) TESTS 40 93 72396800 2200
219033488 Evan_Liu D Aug. 16, 2023, 12:35 a.m. OK GNU C++20 (64) TESTS 39 108 72294400 2200
219033404 Evan_Liu D Aug. 16, 2023, 12:33 a.m. OK GNU C++20 (64) TESTS 39 108 72294400 2200
218997036 soon_to_be_lgm D Aug. 15, 2023, 4:30 p.m. OK GNU C++20 (64) TESTS 39 108 72396800 2200
219009818 therehello D Aug. 15, 2023, 5:58 p.m. OK GNU C++20 (64) TESTS 39 109 37888000 2200
219013340 kaiboy D Aug. 15, 2023, 6:31 p.m. OK GNU C++20 (64) TESTS 39 109 72192000 2200
219014871 NintsiChkhaidze D Aug. 15, 2023, 6:48 p.m. OK GNU C++20 (64) TESTS 39 109 72294400 2200
219051393 Ice_teapoy D Aug. 16, 2023, 4:02 a.m. OK GNU C++20 (64) TESTS 40 109 72396800 2200
219016314 sad_truant D Aug. 15, 2023, 7:04 p.m. OK Java 11 TESTS 39 545 78848000 2200
219054100 dzhi D Aug. 16, 2023, 4:39 a.m. OK Java 11 TESTS 40 545 259891200 2200
219051716 Vikas_Ahlawat D Aug. 16, 2023, 4:06 a.m. OK Java 11 TESTS 40 1435 260812800 2200
219009270 profchi D Aug. 15, 2023, 5:54 p.m. OK Java 11 TESTS 39 1450 143974400 2200
219053279 dzhi D Aug. 16, 2023, 4:28 a.m. OK Java 11 TESTS 40 2401 259891200 2200
219049307 Java_Programmer D Aug. 16, 2023, 3:35 a.m. OK Java 8 TESTS 40 451 77619200 2200
219009710 NerfThis D Aug. 15, 2023, 5:57 p.m. OK Java 8 TESTS 39 499 200601600 2200
218998814 The_terminator D Aug. 15, 2023, 4:33 p.m. OK Java 8 TESTS 39 655 73625600 2200
219003452 UniversalAdmin D Aug. 15, 2023, 5:12 p.m. OK Java 8 TESTS 39 1388 77107200 2200
218995316 cc4414 D Aug. 15, 2023, 4:27 p.m. OK Java 8 TESTS 39 1497 77004800 2200
219058624 B.i.b.e.r D Aug. 16, 2023, 5:32 a.m. OK PyPy 3 TESTS 40 982 96153600 2200
219023842 plevande D Aug. 15, 2023, 8:43 p.m. OK PyPy 3 TESTS 39 1325 182988800 2200
219055003 B.i.b.e.r D Aug. 16, 2023, 4:50 a.m. OK PyPy 3 TESTS 40 1637 82636800 2200
219015162 petamingks D Aug. 15, 2023, 6:52 p.m. OK PyPy 3 TESTS 39 1652 184115200 2200
219017138 sushmanth.dampur8780 D Aug. 15, 2023, 7:14 p.m. OK PyPy 3 TESTS 39 1809 183603200 2200
218998619 Alex239 D Aug. 15, 2023, 4:33 p.m. OK PyPy 3 TESTS 39 2308 195686400 2200
219006633 CinaDor D Aug. 15, 2023, 5:33 p.m. OK PyPy 3-64 TESTS 39 826 157696000 2200
219005325 9.86960440109 D Aug. 15, 2023, 5:23 p.m. OK PyPy 3-64 TESTS 39 935 151756800 2200
219023502 MasterVroom D Aug. 15, 2023, 8:37 p.m. OK PyPy 3-64 TESTS 39 1169 154624000 2200
219001882 zouyu9631 D Aug. 15, 2023, 5:06 p.m. OK PyPy 3-64 TESTS 39 1699 182272000 2200
219021354 pedrosorio D Aug. 15, 2023, 8:06 p.m. OK PyPy 3-64 TESTS 39 2682 250265600 2200
218998432 gluchie D Aug. 15, 2023, 4:33 p.m. OK Rust 2021 TESTS 39 186 75366400 2200

remove filters

Back to search problems