Codeforces Round 941 (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
1965 Codeforces Round 941 (Div. 1) FINISHED False 7200 17594699 April 27, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1949 ) C Folding Strip PROGRAMMING constructive algorithms greedy strings 2300

B"You have a strip of paper with a binary string s of length n . You can fold the paper in between any pair of adjacent digits. A set of folds is considered valid if after the folds, all characters that are on top of or below each other match. Note that all folds are made at the same time, so the characters don't have to match in between folds. For example, these are valid foldings of s = mathtt{110110110011} and s = mathtt{01110} : The length of the folded strip is the length seen from above after all folds are made. So for the two above examples, after the folds shown above, the lengths would be 7 and 3 , respectively. Notice that for the above folding of s = mathtt{01110} , if we made either of the two folds on their own, that would not be a valid folding. However, because we don't check for validity until all folds are made, this folding is valid. After performing a set of valid folds, what is the minimum length strip you can form? The first line of the input contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer n ( 1 <= n <= 2 cdot 10^5 ) -- the size of the strip. The second line of each test case contains a string s of n characters '0' and '1' -- a description of the digits on the strip. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output a single integer -- the minimum possible length of the strip after a valid folding. For the first example case, one optimal folding is to fold the strip in the middle, which produces a strip of length 3. The third and fourth example cases correspond to the images above. Note that the folding shown above for s = mathtt{110110110011} is not of minimal length. "...

Tutorials

Codeforces Round #941 (Div. 1, Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
258454475 mban259 C April 27, 2024, 3:56 p.m. OK C# 10 TESTS 70 139 1740800 2300
261710338 yuhang_ C May 20, 2024, 12:20 a.m. OK C++14 (GCC 6-32) TESTS 70 61 204800 2300
258579212 2114992323 C April 28, 2024, 3 p.m. OK C++14 (GCC 6-32) TESTS 70 61 204800 2300
259626444 514InParadise C May 5, 2024, 11:40 a.m. OK C++14 (GCC 6-32) TESTS 70 61 1024000 2300
263604405 andreystefanov C June 1, 2024, 9:13 a.m. OK C++14 (GCC 6-32) TESTS 70 62 0 2300
263052720 dmot C May 28, 2024, 6:24 p.m. OK C++14 (GCC 6-32) TESTS 70 62 0 2300
259119070 wangmarui C May 2, 2024, 12:23 p.m. OK C++14 (GCC 6-32) TESTS 70 62 102400 2300
262952863 masonpop C May 28, 2024, 3:57 a.m. OK C++14 (GCC 6-32) TESTS 70 62 204800 2300
262156893 Wind_Walker C May 22, 2024, 2:20 p.m. OK C++14 (GCC 6-32) TESTS 70 62 204800 2300
262156154 Wind_Walker C May 22, 2024, 2:09 p.m. OK C++14 (GCC 6-32) TESTS 70 62 204800 2300
262138164 kkksc998 C May 22, 2024, 11:42 a.m. OK C++14 (GCC 6-32) TESTS 70 62 204800 2300
258516128 Shirost C April 28, 2024, 5:01 a.m. OK C++17 (GCC 7-32) TESTS 70 46 1024000 2300
261121891 LeNcyer C May 16, 2024, 3:09 a.m. OK C++17 (GCC 7-32) TESTS 70 61 0 2300
259098252 PoetryFactory C May 2, 2024, 8:09 a.m. OK C++17 (GCC 7-32) TESTS 70 61 0 2300
258633074 JiaY19 C April 29, 2024, 3:22 a.m. OK C++17 (GCC 7-32) TESTS 70 61 0 2300
258506463 Superposition C April 28, 2024, 2:56 a.m. OK C++17 (GCC 7-32) TESTS 70 61 0 2300
258510030 Roopa_003 C April 28, 2024, 4:13 a.m. OK C++17 (GCC 7-32) TESTS 70 61 204800 2300
261038824 Koosha_Mv C May 15, 2024, 10:34 a.m. OK C++17 (GCC 7-32) TESTS 70 61 7987200 2300
262995118 Joey_c C May 28, 2024, 10:28 a.m. OK C++17 (GCC 7-32) TESTS 70 62 0 2300
262753036 GTA C May 26, 2024, 3:19 p.m. OK C++17 (GCC 7-32) TESTS 70 62 0 2300
262005218 Xorzj C May 21, 2024, 11:18 a.m. OK C++17 (GCC 7-32) TESTS 70 62 0 2300
262943472 amsen C May 28, 2024, 1:10 a.m. OK C++20 (GCC 13-64) TESTS 70 46 0 2300
258510845 prz1213 C April 28, 2024, 4:29 a.m. OK C++20 (GCC 13-64) TESTS 70 46 0 2300
258516503 Retired_Isaunoya C April 28, 2024, 5:08 a.m. OK C++20 (GCC 13-64) TESTS 70 46 102400 2300
261750400 luogu_bot5 C May 20, 2024, 8:48 a.m. OK C++20 (GCC 13-64) TESTS 70 61 0 2300
260909167 ocharin C May 14, 2024, 10:17 a.m. OK C++20 (GCC 13-64) TESTS 70 61 0 2300
259468594 riano_ C May 4, 2024, 7:39 a.m. OK C++20 (GCC 13-64) TESTS 70 61 0 2300
259266072 mafailure C May 2, 2024, 7:23 p.m. OK C++20 (GCC 13-64) TESTS 70 61 0 2300
259251265 Ormlis C May 2, 2024, 5:19 p.m. OK C++20 (GCC 13-64) TESTS 70 61 0 2300
258821138 sunkuangzheng C April 30, 2024, 6:41 a.m. OK C++20 (GCC 13-64) TESTS 70 61 0 2300
258806314 rui_er C April 30, 2024, 3:08 a.m. OK C++20 (GCC 13-64) TESTS 70 61 0 2300
258427165 Gassa C April 27, 2024, 2:53 p.m. OK D TESTS 70 93 2969600 2300
259094794 fanfly C May 2, 2024, 7:33 a.m. OK GNU C11 TESTS 70 93 307200 2300
258494287 chro4896 C April 27, 2024, 9:32 p.m. OK GNU C11 TESTS 70 93 307200 2300
258481946 rainboy C April 27, 2024, 7:04 p.m. OK GNU C11 TESTS 70 108 409600 2300
261017402 new2ac C May 15, 2024, 7:31 a.m. OK Java 21 TESTS 70 280 921600 2300
258582856 IceWolf898 C April 28, 2024, 3:30 p.m. OK Java 21 TESTS 70 281 614400 2300
258508321 profchi C April 28, 2024, 3:38 a.m. OK Java 21 TESTS 70 281 1126400 2300
259701333 grace.rd.xu C May 6, 2024, 3:48 a.m. OK Java 21 TESTS 70 312 1126400 2300
260931254 2210030072 C May 14, 2024, 1:09 p.m. OK Java 21 TESTS 70 359 1433600 2300
258544347 yvbf C April 28, 2024, 9:48 a.m. OK Java 8 TESTS 70 155 0 2300
259132959 2200033007_KLU C May 2, 2024, 2:34 p.m. OK Java 8 TESTS 70 187 0 2300
258454961 golions C April 27, 2024, 3:58 p.m. OK Java 8 TESTS 70 187 0 2300
258446287 knightL C April 27, 2024, 3:34 p.m. OK Java 8 TESTS 70 202 0 2300
258541947 yvbf C April 28, 2024, 9:25 a.m. OK Java 8 TESTS 70 203 0 2300
258455202 SecondThread C April 27, 2024, 3:58 p.m. OK Java 8 TESTS 70 218 39321600 2300
260593870 chinatest C May 12, 2024, 12:17 a.m. OK Java 8 TESTS 70 249 0 2300
258664265 mahekgondaliya C April 29, 2024, 9:43 a.m. OK Java 8 TESTS 70 296 0 2300
258520346 xblwyc_hardcore C April 28, 2024, 6:05 a.m. OK Kotlin 1.9 TESTS 70 202 0 2300
258434923 Tlatoani C April 27, 2024, 3:08 p.m. OK Kotlin 1.9 TESTS 70 202 0 2300
258429841 bruhopen C April 27, 2024, 2:58 p.m. OK Kotlin 1.9 TESTS 70 203 0 2300
260833954 plevande C May 13, 2024, 4:54 p.m. OK PyPy 3 TESTS 70 171 4812800 2300
258590067 The.Answer C April 28, 2024, 4 p.m. OK PyPy 3 TESTS 70 265 6451200 2300
258979910 Soshka C May 1, 2024, 7:46 a.m. OK PyPy 3 TESTS 70 280 6041600 2300
258418287 conqueror_of_tourist C April 27, 2024, 2:39 p.m. OK PyPy 3-64 TESTS 70 124 2969600 2300
258495616 cybsbbb C April 27, 2024, 10:01 p.m. OK PyPy 3-64 TESTS 70 125 4608000 2300
259704372 GuEnhao C May 6, 2024, 4:49 a.m. OK PyPy 3-64 TESTS 70 140 4915200 2300
261711216 Synaptic_Savant C May 20, 2024, 12:52 a.m. OK PyPy 3-64 TESTS 70 140 15155200 2300
258857017 khuepr123 C April 30, 2024, 1:20 p.m. OK PyPy 3-64 TESTS 70 156 3788800 2300
258535499 Wizard_of_Orz C April 28, 2024, 8:30 a.m. OK PyPy 3-64 TESTS 70 156 5222400 2300
259696521 tlsgusrb314 C May 6, 2024, 1:56 a.m. OK PyPy 3-64 TESTS 70 156 11776000 2300
262774308 mnbvcxz123_long_dick C May 26, 2024, 4:21 p.m. OK PyPy 3-64 TESTS 70 171 4608000 2300
258567470 hichabe.aya C April 28, 2024, 1:21 p.m. OK PyPy 3-64 TESTS 70 171 4608000 2300
258454054 jimini23kjm C April 27, 2024, 3:55 p.m. OK PyPy 3-64 TESTS 70 171 9011200 2300
258458638 Jimanbanashi C April 27, 2024, 4:08 p.m. OK Python 2 TESTS 70 155 0 2300
261279763 lzw75 C May 17, 2024, 5:11 a.m. OK Python 3 TESTS 70 171 4403200 2300
259418875 Gegedosh MakShon kapopenko C May 3, 2024, 8:31 p.m. OK Python 3 TESTS 70 218 0 2300
259264796 Vedant_Borkar C May 2, 2024, 7:09 p.m. OK Python 3 TESTS 70 249 0 2300
259097290 lalitha_72 C May 2, 2024, 7:58 a.m. OK Python 3 TESTS 70 249 0 2300
260019390 bao_do C May 8, 2024, 3:25 p.m. OK Rust 2021 TESTS 70 62 0 2300
259967829 dimastrakhal C May 8, 2024, 8:05 a.m. OK Rust 2021 TESTS 70 62 0 2300
258486554 n685 C April 27, 2024, 7:57 p.m. OK Rust 2021 TESTS 70 62 0 2300
258805734 BetterThanNobita C April 30, 2024, 2:57 a.m. OK Rust 2021 TESTS 70 62 102400 2300
258495111 M1ngXu C April 27, 2024, 9:49 p.m. OK Rust 2021 TESTS 70 77 0 2300
258440271 sansen C April 27, 2024, 3:19 p.m. OK Rust 2021 TESTS 70 77 0 2300
258490420 toomer C April 27, 2024, 8:31 p.m. OK Rust 2021 TESTS 70 77 102400 2300
258456197 MaxBuzz C April 27, 2024, 4:01 p.m. OK Scala TESTS 70 499 0 2300
262417285 Gendulf C May 24, 2024, 5:03 p.m. OK Scala TESTS 70 906 16179200 2300

remove filters

Back to search problems