Codeforces Round 958 (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
1988 Codeforces Round 958 (Div. 2) FINISHED False 7200 16125863 July 15, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 23518 ) B Make Majority PROGRAMMING greedy

B"You are given a sequence [a_1, ldots,a_n] where each element a_i is either 0 or 1 . You can apply several (possibly zero) operations to the sequence. In each operation, you select two integers 1 <= l <= r <= |a| (where |a| is the current length of a ) and replace [a_l, ldots,a_r] with a single element x , where x is the majority of [a_l, ldots,a_r] . Here, the majority of a sequence consisting of 0 and 1 is defined as follows: suppose there are c_0 zeros and c_1 ones in the sequence, respectively. For example, suppose a=[1,0,0,0,1,1] . If we select l=1,r=2 , the resulting sequence will be [0,0,0,1,1] . If we select l=4,r=6 , the resulting sequence will be [1,0,0,1] . Determine if you can make a=[1] with a finite number of operations. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 4 cdot 10^4 ). Description of the test cases follows. The first line of each testcase contains one integer n ( 1 <= n <= 2 cdot 10^5 ). The second line of each testcase contains a string consisting of 0 and 1 , describing the sequence a . It's guaranteed that the sum of n over all testcases does not exceed 2 cdot 10^5 . For each testcase, if it's possible to make a=[1] , print YES. Otherwise, print NO. You can output the answer in any case (upper or lower). For example, the strings yEs, yes, Yes, and YES will be recognized as positive responses. In the fourth testcase of the example, initially a=[1,0,0,0,0,0,0,0,1] . A valid sequence of operations is: "...

Tutorials

Editorial of Codeforces Round 958 (Div. 2)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
270752179 kokora B July 15, 2024, 6:02 p.m. OK C# 10 TESTS 20 171 3276800
270793315 luogu_bot2 B July 16, 2024, 2:09 a.m. OK C++14 (GCC 6-32) TESTS 26 46 1024000
270800779 sz_jinzikai01 B July 16, 2024, 3:24 a.m. OK C++14 (GCC 6-32) TESTS 26 61 0
270799880 JEdward B July 16, 2024, 3:15 a.m. OK C++14 (GCC 6-32) TESTS 26 61 0
270755577 Abhay5055 B July 15, 2024, 6:25 p.m. OK C++14 (GCC 6-32) TESTS 24 61 0
270816510 skangude5 B July 16, 2024, 6:05 a.m. OK C++14 (GCC 6-32) TESTS 26 61 0
270744514 ravikjha7 B July 15, 2024, 5:22 p.m. OK C++14 (GCC 6-32) TESTS 20 61 0
270790983 tryandtryagain B July 16, 2024, 1:44 a.m. OK C++14 (GCC 6-32) TESTS 26 61 204800
270799993 luogu_bot2 B July 16, 2024, 3:17 a.m. OK C++14 (GCC 6-32) TESTS 26 61 1024000
270800670 aadarshg087 B July 16, 2024, 3:23 a.m. OK C++14 (GCC 6-32) TESTS 26 62 0
270799427 ljy_cjr B July 16, 2024, 3:11 a.m. OK C++14 (GCC 6-32) TESTS 26 62 0
270790546 asaltfish B July 16, 2024, 1:40 a.m. OK C++17 (GCC 7-32) TESTS 26 46 0
270814882 Manoj_Dhundhalva B July 16, 2024, 5:51 a.m. OK C++17 (GCC 7-32) TESTS 26 46 0
270814417 Uttam_Paharia B July 16, 2024, 5:47 a.m. OK C++17 (GCC 7-32) TESTS 26 46 0
270807526 CodeXSayak B July 16, 2024, 4:36 a.m. OK C++17 (GCC 7-32) TESTS 26 46 0
270802375 Prince_king B July 16, 2024, 3:40 a.m. OK C++17 (GCC 7-32) TESTS 26 46 0
270801246 Drink_Medicine B July 16, 2024, 3:29 a.m. OK C++17 (GCC 7-32) TESTS 26 46 0
270798910 serenipity B July 16, 2024, 3:06 a.m. OK C++17 (GCC 7-32) TESTS 26 46 0
270797202 altAndras B July 16, 2024, 2:49 a.m. OK C++17 (GCC 7-32) TESTS 26 46 0
270795743 sahil_beck B July 16, 2024, 2:34 a.m. OK C++17 (GCC 7-32) TESTS 26 46 0
270787567 Avik_07 B July 16, 2024, 1:11 a.m. OK C++17 (GCC 7-32) TESTS 26 46 0
270803609 mere_ B July 16, 2024, 3:52 a.m. OK C++20 (GCC 13-64) TESTS 26 46 0
270815699 sweet_hope25 B July 16, 2024, 5:58 a.m. OK C++20 (GCC 13-64) TESTS 26 46 0
270814073 aremes95 B July 16, 2024, 5:44 a.m. OK C++20 (GCC 13-64) TESTS 26 46 0
270811650 anomitroid B July 16, 2024, 5:20 a.m. OK C++20 (GCC 13-64) TESTS 26 46 0
270808687 not_random B July 16, 2024, 4:50 a.m. OK C++20 (GCC 13-64) TESTS 26 46 0
270805287 xiaolizi B July 16, 2024, 4:11 a.m. OK C++20 (GCC 13-64) TESTS 26 46 0
270804874 rndmcoderr B July 16, 2024, 4:05 a.m. OK C++20 (GCC 13-64) TESTS 26 46 0
270798966 kingbass B July 16, 2024, 3:07 a.m. OK C++20 (GCC 13-64) TESTS 26 46 0
270798150 PH_modest B July 16, 2024, 2:59 a.m. OK C++20 (GCC 13-64) TESTS 26 46 0
270797727 YOUR-SUN B July 16, 2024, 2:55 a.m. OK C++20 (GCC 13-64) TESTS 26 46 0
270776868 bluemegane B July 15, 2024, 10:12 p.m. OK C# 8 TESTS 26 155 2355200
270767167 UsingJester B July 15, 2024, 8:09 p.m. OK GNU C11 TESTS 26 186 307200
270811541 anamitrarray B July 16, 2024, 5:19 a.m. OK GNU C11 TESTS 26 202 204800
270793633 Sparkle_Twilight B July 16, 2024, 2:13 a.m. OK GNU C11 TESTS 26 202 307200
270793620 mrwisdon B July 16, 2024, 2:12 a.m. OK GNU C11 TESTS 26 202 307200
270761954 atharvatol04 B July 15, 2024, 7:18 p.m. OK GNU C11 TESTS 26 202 307200
270744685 AurrieMartinez B July 15, 2024, 5:22 p.m. OK GNU C11 TESTS 20 202 1843200
270760422 Toneshwar B July 15, 2024, 7:03 p.m. OK GNU C11 TESTS 26 217 307200
270805700 snowball27 B July 16, 2024, 4:16 a.m. OK GNU C11 TESTS 26 218 512000
270800993 botayhard B July 16, 2024, 3:26 a.m. OK Go TESTS 26 93 18739200
270792312 nguyenquocthao00 B July 16, 2024, 1:59 a.m. OK Go TESTS 26 108 5734400
270753098 AkshatSaxena_05 B July 15, 2024, 6:08 p.m. OK Java 21 TESTS 20 249 716800
270744411 kunalraj8051 B July 15, 2024, 5:21 p.m. OK Java 21 TESTS 20 264 614400
270804054 yang_wei B July 16, 2024, 3:56 a.m. OK Java 21 TESTS 26 264 921600
270802501 susvant B July 16, 2024, 3:41 a.m. OK Java 21 TESTS 26 265 921600
270749657 _Abhinavv_ B July 15, 2024, 5:47 p.m. OK Java 21 TESTS 20 280 1843200
270756135 ankush9140 B July 15, 2024, 6:29 p.m. OK Java 21 TESTS 24 281 614400
270793917 amit_roy B July 16, 2024, 2:15 a.m. OK Java 21 TESTS 26 281 1740800
270746310 pranp_24 B July 15, 2024, 5:29 p.m. OK Java 21 TESTS 20 296 819200
270794138 _global B July 16, 2024, 2:18 a.m. OK Java 21 TESTS 26 296 1638400
270767534 ankitv9936 B July 15, 2024, 8:12 p.m. OK Java 21 TESTS 26 312 614400
270779534 Hinnawi24 B July 15, 2024, 11:01 p.m. OK Java 8 TESTS 26 140 0
270756689 aishwarykesarwani B July 15, 2024, 6:33 p.m. OK Java 8 TESTS 25 186 0
270803430 om172 B July 16, 2024, 3:50 a.m. OK Java 8 TESTS 26 249 0
270814603 uruz31 B July 16, 2024, 5:48 a.m. OK Java 8 TESTS 26 265 0
270748649 KaranKamath B July 15, 2024, 5:41 p.m. OK Java 8 TESTS 20 281 0
270761948 Sumitsingh7 B July 15, 2024, 7:18 p.m. OK Java 8 TESTS 26 296 8089600
270813916 amansheo B July 16, 2024, 5:42 a.m. OK Java 8 TESTS 26 343 0
270757887 debayanari B July 15, 2024, 6:42 p.m. OK Java 8 TESTS 25 358 0
270757550 ankithal765 B July 15, 2024, 6:39 p.m. OK Java 8 TESTS 25 358 0
270809333 Om77 B July 16, 2024, 4:57 a.m. OK Java 8 TESTS 26 359 0
270761425 Alex_Toppo_06 B July 15, 2024, 7:13 p.m. OK Kotlin 1.9 TESTS 26 343 0
270761278 Alex_Toppo_06 B July 15, 2024, 7:12 p.m. OK Kotlin 1.9 TESTS 26 343 0
270801971 mythicalrocket B July 16, 2024, 3:36 a.m. OK PyPy 3 TESTS 26 156 9932800
270775179 x3mka B July 15, 2024, 9:45 p.m. OK PyPy 3 TESTS 26 218 9216000
270775613 x3mka B July 15, 2024, 9:51 p.m. OK PyPy 3 TESTS 26 249 8601600
270759324 x3mka B July 15, 2024, 6:54 p.m. OK PyPy 3 TESTS 26 296 9625600
270791880 nealzane B July 16, 2024, 1:54 a.m. OK PyPy 3 TESTS 26 406 9830400
270794029 TheBestFromEast B July 16, 2024, 2:17 a.m. OK PyPy 3 TESTS 26 515 9420800
270766358 1234567890123 B July 15, 2024, 8 p.m. OK PyPy 3 TESTS 26 593 14336000
270759484 WalrusRamen21 B July 15, 2024, 6:55 p.m. OK PyPy 3 TESTS 26 609 9728000
270752413 papdichaat B July 15, 2024, 6:03 p.m. OK PyPy 3 TESTS 20 609 10035200
270816034 vaibhav245 B July 16, 2024, 6:01 a.m. OK PyPy 3 TESTS 26 640 10854400
270786660 hello_world0421 B July 16, 2024, 12:59 a.m. OK PyPy 3-64 TESTS 26 108 6041600
270751469 AntonKorch B July 15, 2024, 5:57 p.m. OK PyPy 3-64 TESTS 20 109 2867200
270805163 gardengnome B July 16, 2024, 4:09 a.m. OK PyPy 3-64 TESTS 26 109 6656000
270752921 anshgoel2580 B July 15, 2024, 6:07 p.m. OK PyPy 3-64 TESTS 20 109 7475200
270797575 mikeac B July 16, 2024, 2:53 a.m. OK PyPy 3-64 TESTS 26 124 7168000
270782343 hxu10 B July 15, 2024, 11:56 p.m. OK PyPy 3-64 TESTS 26 124 7884800
270750602 AntonKorch B July 15, 2024, 5:52 p.m. OK PyPy 3-64 TESTS 20 124 13107200
270769147 MistaFlash B July 15, 2024, 8:30 p.m. OK PyPy 3-64 TESTS 26 125 6656000
270760308 RobinFromTheHood B July 15, 2024, 7:02 p.m. OK PyPy 3-64 TESTS 26 139 15974400
270761370 Amay12 B July 15, 2024, 7:12 p.m. OK PyPy 3-64 TESTS 26 140 22528000
270749523 CodeArmy B July 15, 2024, 5:46 p.m. OK Python 3 TESTS 20 140 6553600
270746298 eugalt B July 15, 2024, 5:29 p.m. OK Python 3 TESTS 20 140 6553600
270792018 Inevitable_way B July 16, 2024, 1:56 a.m. OK Python 3 TESTS 26 249 0
270791540 Inevitable_way B July 16, 2024, 1:51 a.m. OK Python 3 TESTS 26 264 0
270759236 Apaw_X B July 15, 2024, 6:53 p.m. OK Python 3 TESTS 26 264 0
270751939 surendra26 B July 15, 2024, 6 p.m. OK Python 3 TESTS 20 264 0
270812319 tfgkk B July 16, 2024, 5:27 a.m. OK Python 3 TESTS 26 265 0
270803463 bnuwjy B July 16, 2024, 3:50 a.m. OK Python 3 TESTS 26 265 0
270795604 World_last B July 16, 2024, 2:32 a.m. OK Python 3 TESTS 26 265 0
270747655 altruistic99 B July 15, 2024, 5:36 p.m. OK Python 3 TESTS 20 265 0
270745671 Cheshulko B July 15, 2024, 5:26 p.m. OK Rust 2021 TESTS 20 124 0

remove filters

Back to search problems