Codeforces Round 829 (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
1753 Codeforces Round 829 (Div. 1) FINISHED False 7200 65311799 Oct. 23, 2022, 7:50 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 10471 ) A2 Make Nonzero Sum (hard version) PROGRAMMING constructive algorithms dp greedy 1500

B"This is the hard version of the problem. The difference is that in this version the array contains zeros. You can make hacks only if both versions of the problem are solved. You are given an array [a_1, a_2, ldots a_n] consisting of integers -1 , 0 and 1 . You have to build a partition of this array into the set of segments [l_1, r_1], [l_2, r_2], ldots, [l_k, r_k] with the following property: Note that each s_i does not have to be equal to zero, this property is about sum of s_i over all segments of partition. The set of segments [l_1, r_1], [l_2, r_2], ldots, [l_k, r_k] is called a partition of the array a of length n if 1 = l_1 <= r_1, l_2 <= r_2, ldots, l_k <= r_k = n and r_i + 1 = l_{i+1} for all i = 1, 2, ldots k-1 . In other words, each element of the array must belong to exactly one segment. You have to build a partition of the given array with properties described above or determine that such partition does not exist. Note that it is not required to minimize the number of segments in the partition. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10 ,000 ). Description of the test cases follows. The first line of each test case contains an integer n ( 1 <= n <= 200 ,000 ) -- the length of array a . The second line of each test case contains n integers a_1, a_2, ldots, a_n ( a_i is -1 , 0 , or 1 ) -- the elements of the given array. It's guaranteed that the sum of n over all test cases does not exceed 200 ,000 . For each test case print an integer k -- the number of segments in the partition. If required partition does not exist, print -1 . If partition exists, in the i -th of the following k lines print two integers l_i and r_i -- description of the i -th segment. The following conditions should"...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
177561491 mban259 A2 Oct. 23, 2022, 8:21 a.m. OK C# 10 TESTS 13 109 24064000 1500
177562751 DmitriyAnikeyev A2 Oct. 23, 2022, 8:23 a.m. OK C# 10 TESTS 13 405 22016000 1500
177551915 KumaTachiRen A2 Oct. 23, 2022, 8:09 a.m. OK C# 8 TESTS 13 124 21401600 1500
177561175 Gassa A2 Oct. 23, 2022, 8:21 a.m. OK D TESTS 13 93 24371200 1500
177544760 hos.lyric A2 Oct. 23, 2022, 8:02 a.m. OK D TESTS 13 124 6144000 1500
177572323 Leasier A2 Oct. 23, 2022, 8:38 a.m. OK GNU C11 TESTS 13 452 3993600 1500
177549398 chro4896 A2 Oct. 23, 2022, 8:07 a.m. OK GNU C11 TESTS 13 857 2355200 1500
177546645 enoamaoae A2 Oct. 23, 2022, 8:04 a.m. OK GNU C++14 TESTS 13 31 22323200 1500
177570910 happydef A2 Oct. 23, 2022, 8:35 a.m. OK GNU C++14 TESTS 13 31 70758400 1500
177574166 Hencecho A2 Oct. 23, 2022, 8:41 a.m. OK GNU C++14 TESTS 13 31 136908800 1500
177554037 CQYZWJH A2 Oct. 23, 2022, 8:11 a.m. OK GNU C++14 TESTS 13 46 2150400 1500
177595693 shiyihangxs A2 Oct. 23, 2022, 9:28 a.m. OK GNU C++14 TESTS 13 46 2457600 1500
177704111 shiyihangxs A2 Oct. 23, 2022, 11:45 p.m. OK GNU C++14 TESTS 13 46 2457600 1500
177704063 ducati A2 Oct. 23, 2022, 11:44 p.m. OK GNU C++14 TESTS 13 46 2662400 1500
177561770 ykl A2 Oct. 23, 2022, 8:21 a.m. OK GNU C++14 TESTS 13 46 3174400 1500
177583348 w4p3r A2 Oct. 23, 2022, 8:59 a.m. OK GNU C++14 TESTS 13 46 3174400 1500
177566209 DingWentao2004 A2 Oct. 23, 2022, 8:28 a.m. OK GNU C++14 TESTS 13 46 3993600 1500
177557977 zhaojinxi A2 Oct. 23, 2022, 8:16 a.m. OK GNU C++17 TESTS 13 15 7372800 1500
177583944 Bobocan A2 Oct. 23, 2022, 9 a.m. OK GNU C++17 TESTS 13 31 3686400 1500
177553718 Amel A2 Oct. 23, 2022, 8:11 a.m. OK GNU C++17 TESTS 13 46 819200 1500
177555049 Riblji_Keksic A2 Oct. 23, 2022, 8:13 a.m. OK GNU C++17 TESTS 13 46 1331200 1500
177549086 chen_zexing A2 Oct. 23, 2022, 8:06 a.m. OK GNU C++17 TESTS 13 46 2048000 1500
177599975 LJQYYDS A2 Oct. 23, 2022, 9:38 a.m. OK GNU C++17 TESTS 13 46 3993600 1500
177587161 mhmhm A2 Oct. 23, 2022, 9:07 a.m. OK GNU C++17 TESTS 13 61 1945600 1500
177549942 yaoxi A2 Oct. 23, 2022, 8:07 a.m. OK GNU C++17 TESTS 13 61 3993600 1500
177698631 Here_I_Go420 A2 Oct. 23, 2022, 9:08 p.m. OK GNU C++17 TESTS 13 61 4812800 1500
177586683 Paizen A2 Oct. 23, 2022, 9:06 a.m. OK GNU C++17 TESTS 13 62 1945600 1500
177578935 Hackenbush A2 Oct. 23, 2022, 8:50 a.m. OK GNU C++17 (64) TESTS 13 30 2150400 1500
177562534 eriksuenderhauf A2 Oct. 23, 2022, 8:22 a.m. OK GNU C++17 (64) TESTS 13 31 1638400 1500
177544105 QAQAutoMaton A2 Oct. 23, 2022, 8:02 a.m. OK GNU C++17 (64) TESTS 13 31 8704000 1500
177566153 Freedom__King A2 Oct. 23, 2022, 8:28 a.m. OK GNU C++17 (64) TESTS 13 31 17612800 1500
177551380 J_B_Y A2 Oct. 23, 2022, 8:09 a.m. OK GNU C++17 (64) TESTS 13 46 2662400 1500
177554265 SW2000 A2 Oct. 23, 2022, 8:12 a.m. OK GNU C++17 (64) TESTS 13 46 2969600 1500
177554065 edenooo A2 Oct. 23, 2022, 8:11 a.m. OK GNU C++17 (64) TESTS 13 46 2969600 1500
177550525 zyz07 A2 Oct. 23, 2022, 8:08 a.m. OK GNU C++17 (64) TESTS 13 46 2969600 1500
177574458 HCPS42 A2 Oct. 23, 2022, 8:42 a.m. OK GNU C++17 (64) TESTS 13 46 2969600 1500
177554750 KanaD A2 Oct. 23, 2022, 8:12 a.m. OK GNU C++17 (64) TESTS 13 46 2969600 1500
177555891 CLT A2 Oct. 23, 2022, 8:14 a.m. OK GNU C++20 (64) TESTS 13 30 6041600 1500
177551427 Sakuyalove A2 Oct. 23, 2022, 8:09 a.m. OK GNU C++20 (64) TESTS 13 30 10649600 1500
177584088 risujiroh A2 Oct. 23, 2022, 9 a.m. OK GNU C++20 (64) TESTS 13 31 819200 1500
177579632 zxynothing A2 Oct. 23, 2022, 8:51 a.m. OK GNU C++20 (64) TESTS 13 31 1536000 1500
177570595 mathdude42 A2 Oct. 23, 2022, 8:35 a.m. OK GNU C++20 (64) TESTS 13 31 1638400 1500
177572351 xox0 A2 Oct. 23, 2022, 8:38 a.m. OK GNU C++20 (64) TESTS 13 31 1638400 1500
177656340 _dlbm17 A2 Oct. 23, 2022, 2:14 p.m. OK GNU C++20 (64) TESTS 13 31 4710400 1500
177582501 DAleksa A2 Oct. 23, 2022, 8:57 a.m. OK GNU C++20 (64) TESTS 13 31 5017600 1500
177547269 maspy A2 Oct. 23, 2022, 8:04 a.m. OK GNU C++20 (64) TESTS 13 31 7987200 1500
177571054 MohammadParsaElahimanesh A2 Oct. 23, 2022, 8:36 a.m. OK GNU C++20 (64) TESTS 13 31 10649600 1500
177553649 earl_of_byteland A2 Oct. 23, 2022, 8:11 a.m. OK Java 11 TESTS 13 312 16384000 1500
177560921 dusty.and.rusty A2 Oct. 23, 2022, 8:20 a.m. OK Java 17 TESTS 13 545 15974400 1500
177570306 megaspazz A2 Oct. 23, 2022, 8:34 a.m. OK Java 8 TESTS 13 155 0 1500
177556754 fetetriste A2 Oct. 23, 2022, 8:15 a.m. OK Java 8 TESTS 13 217 9830400 1500
177668484 anonxx5 A2 Oct. 23, 2022, 3:50 p.m. OK Java 8 TESTS 13 218 9728000 1500
177552640 DarLam A2 Oct. 23, 2022, 8:10 a.m. OK Java 8 TESTS 13 233 1024000 1500
177722694 goku_peng A2 Oct. 24, 2022, 5:57 a.m. OK Java 8 TESTS 13 374 3276800 1500
177548365 EduRoundOnly A2 Oct. 23, 2022, 8:06 a.m. OK Kotlin 1.4 TESTS 13 202 4812800 1500
177570858 ItamarNir A2 Oct. 23, 2022, 8:35 a.m. OK MS C++ 2017 TESTS 13 187 3993600 1500
177715345 LiuZhaocheng A2 Oct. 24, 2022, 3:54 a.m. OK MS C++ 2017 TESTS 13 904 819200 1500
177572205 bcollet A2 Oct. 23, 2022, 8:38 a.m. OK PyPy 2 TESTS 13 202 18124800 1500
177551940 SPD_9X2 A2 Oct. 23, 2022, 8:09 a.m. OK PyPy 3 TESTS 13 405 29388800 1500
177559996 tassei903 A2 Oct. 23, 2022, 8:19 a.m. OK PyPy 3 TESTS 13 420 17305600 1500
177542397 conqueror_of_tourist A2 Oct. 23, 2022, 8 a.m. OK PyPy 3-64 TESTS 13 171 24780800 1500
177706199 suncup224 A2 Oct. 24, 2022, 12:50 a.m. OK PyPy 3-64 TESTS 13 264 21504000 1500
177559725 9.86960440109 A2 Oct. 23, 2022, 8:19 a.m. OK PyPy 3-64 TESTS 13 264 26419200 1500
177566192 eepsilon A2 Oct. 23, 2022, 8:28 a.m. OK PyPy 3-64 TESTS 13 265 24780800 1500
177566790 szjlove A2 Oct. 23, 2022, 8:29 a.m. OK PyPy 3-64 TESTS 13 265 27443200 1500
177557430 delena0702 A2 Oct. 23, 2022, 8:16 a.m. OK PyPy 3-64 TESTS 13 280 29081600 1500
177545070 kyoran A2 Oct. 23, 2022, 8:02 a.m. OK PyPy 3-64 TESTS 13 280 38400000 1500
177584284 Yawn_Sean A2 Oct. 23, 2022, 9:01 a.m. OK PyPy 3-64 TESTS 13 296 35328000 1500
177574503 toam A2 Oct. 23, 2022, 8:42 a.m. OK PyPy 3-64 TESTS 13 311 26214400 1500
177559255 titia A2 Oct. 23, 2022, 8:18 a.m. OK PyPy 3-64 TESTS 13 311 27136000 1500
177543666 Jimanbanashi A2 Oct. 23, 2022, 8:01 a.m. OK Python 2 TESTS 13 326 19046400 1500
177558761 r57shell A2 Oct. 23, 2022, 8:17 a.m. OK Python 3 TESTS 13 233 12083200 1500
177544264 sansen A2 Oct. 23, 2022, 8:02 a.m. OK Rust 2021 TESTS 13 31 5017600 1500
177555449 katand A2 Oct. 23, 2022, 8:13 a.m. OK Rust 2021 TESTS 13 77 18432000 1500
177549409 sufficiently_large_boss A2 Oct. 23, 2022, 8:07 a.m. OK Rust 2021 TESTS 13 1200 3174400 1500

remove filters

Back to search problems