Codeforces Round 1023 (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
2107 Codeforces Round 1023 (Div. 2) FINISHED False 8100 29949923 May 5, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 12003 ) C Maximum Subarray Sum PROGRAMMING binary search constructive algorithms implementation math

You are given an array (a_1,a_2,\ldots,a_n) of length (n) and a positive integer (k), but some parts of the array (a) are missing. Your task is to fill the missing part so that the maximum subarray sum (^{\text{∗}}) of (a) is exactly (k), or report that no solution exists. Formally, you are given a binary string (s) and a partially filled array (a), where: If you remember the value of (a_i), (s_i = 1) to indicate that, and you are given the real value of (a_i). If you don't remember the value of (a_i), (s_i = 0) to indicate that, and you are given (a_i = 0). All the values that you remember satisfy (|a_i| \le 10^6). However, you may use values up to (10^{18}) to fill in the values that you do not remember. It can be proven that if a solution exists, a solution also exists satisfying (|a_i| \le 10^{18}). (^{\text{∗}})The maximum subarray sum of an array (a) of length (n), i.e. (a_1, a_2, \ldots a_n) is defined as (\max_{1 \le i \le j \le n} S(i, j)) where (S(i, j) = a_i + a_{i + 1} + \ldots + a_j). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains two numbers (n,k) ((1 \le n \le 2 \cdot 10^5,1 \le k \le 10^{12})). The second line of each test case contains a binary ((01)) string (s) of length (n). The third line of each test case contains (n) numbers (a_1,a_2,\ldots,a_n) ((|a_i| \le 10^6)). If (s_i = 0), then it's guaranteed that (a_i = 0). It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, first output (Yes) if a solution exists or (No) if no solution exists. You may print each character in either case, for example (YES) and (yEs) wil

Tutorials

Codeforces Round 1023 (Div 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
318539986 -firefly- C May 5, 2025, 5:52 p.m. OK C# 10 TESTS 20 265 32460800
318539325 -firefly- C May 5, 2025, 5:47 p.m. OK C# 10 TESTS 20 265 32563200
318566952 000123 C May 6, 2025, 12:31 a.m. OK C++17 (GCC 7-32) TESTS 20 109 0
318548650 ChineseBheL C May 5, 2025, 7:21 p.m. OK C++17 (GCC 7-32) TESTS 20 109 102400
318554740 srijon_32 C May 5, 2025, 8:57 p.m. OK C++17 (GCC 7-32) TESTS 20 124 0
318560380 Shubh_2005 C May 5, 2025, 11:34 p.m. OK C++17 (GCC 7-32) TESTS 20 124 0
318557094 Eldiiar C May 5, 2025, 9:45 p.m. OK C++17 (GCC 7-32) TESTS 20 124 0
318528556 cr0w C May 5, 2025, 4:49 p.m. OK C++17 (GCC 7-32) TESTS 20 124 0
318576179 fsj2009yx C May 6, 2025, 3:52 a.m. OK C++17 (GCC 7-32) TESTS 20 124 102400
318584421 NOTsoGENIUS_69 C May 6, 2025, 5:59 a.m. OK C++17 (GCC 7-32) TESTS 20 124 102400
318584064 Rasulov_Ardasher C May 6, 2025, 5:54 a.m. OK C++17 (GCC 7-32) TESTS 20 124 102400
318578476 hoducminh10 C May 6, 2025, 4:33 a.m. OK C++17 (GCC 7-32) TESTS 20 124 102400
318568924 _SSH_ C May 6, 2025, 1:22 a.m. OK C++20 (GCC 13-64) TESTS 20 92 3276800
318546916 JackOfMostTrades C May 5, 2025, 7 p.m. OK C++20 (GCC 13-64) TESTS 20 93 0
318583223 suryarao551 C May 6, 2025, 5:43 a.m. OK C++20 (GCC 13-64) TESTS 20 93 0
318581353 hundunlilun1 C May 6, 2025, 5:18 a.m. OK C++20 (GCC 13-64) TESTS 20 93 0
318577626 dyac C May 6, 2025, 4:17 a.m. OK C++20 (GCC 13-64) TESTS 20 93 0
318575084 Smok--ing C May 6, 2025, 3:32 a.m. OK C++20 (GCC 13-64) TESTS 20 93 0
318572194 Jorgitox C May 6, 2025, 2:37 a.m. OK C++20 (GCC 13-64) TESTS 20 93 0
318567601 Guard1an C May 6, 2025, 12:49 a.m. OK C++20 (GCC 13-64) TESTS 20 93 0
318559744 Aom_20 C May 5, 2025, 11:11 p.m. OK C++20 (GCC 13-64) TESTS 20 93 0
318549253 Shivam_Dhingra C May 5, 2025, 7:29 p.m. OK C++20 (GCC 13-64) TESTS 20 93 0
318568233 jaaaaaayyyyyy C May 6, 2025, 1:06 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 78 0
318552420 satyajit1206 C May 5, 2025, 8:18 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 0
318583945 LouisHurtin C May 6, 2025, 5:53 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 0
318572224 _Harsh_chauhan_ C May 6, 2025, 2:37 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 0
318569368 atreyabordoloi C May 6, 2025, 1:33 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 0
318567135 sumuyuri C May 6, 2025, 12:35 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 0
318556898 BABAYAGA__13 C May 5, 2025, 9:40 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 0
318555893 qVYxFWbPpWJvmR C May 5, 2025, 9:20 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 0
318553527 AC_or_TLE C May 5, 2025, 8:35 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 0
318551761 pratik_sinha123 C May 5, 2025, 8:07 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 0
318539142 ruban C May 5, 2025, 5:45 p.m. OK FPC TESTS 20 796 55500800
318524610 shhh... C May 5, 2025, 4:39 p.m. OK GNU C11 TESTS 20 874 2457600
318578409 tekka_ity C May 6, 2025, 4:32 a.m. OK Java 21 TESTS 20 327 819200
318570260 man-ray C May 6, 2025, 1:53 a.m. OK Java 21 TESTS 20 342 1228800
318520491 UdayRajVadeghar C May 5, 2025, 4:27 p.m. OK Java 21 TESTS 20 343 1126400
318537068 InfusedParticle C May 5, 2025, 5:31 p.m. OK Java 21 TESTS 20 358 1228800
318519909 _Caraxes_ C May 5, 2025, 4:25 p.m. OK Java 21 TESTS 20 374 6963200
318577279 akshatsaxena552004.ss C May 6, 2025, 4:11 a.m. OK Java 21 TESTS 20 374 19865600
318574689 yang_wei C May 6, 2025, 3:25 a.m. OK Java 21 TESTS 20 405 1638400
318525330 abhishek_abd_17 C May 5, 2025, 4:41 p.m. OK Java 21 TESTS 20 406 3993600
318541019 barbarian C May 5, 2025, 6:01 p.m. OK Java 21 TESTS 20 406 9011200
318526499 rheetiksharma603 C May 5, 2025, 4:44 p.m. OK Java 21 TESTS 20 421 1126400
318584095 Pranav_45 C May 6, 2025, 5:55 a.m. OK Java 8 TESTS 20 233 5120000
318557244 chearterrs_ka_baap C May 5, 2025, 9:49 p.m. OK Java 8 TESTS 20 264 3072000
318542445 huhansan C May 5, 2025, 6:14 p.m. OK Java 8 TESTS 20 281 4812800
318582015 Dduo C May 6, 2025, 5:27 a.m. OK Java 8 TESTS 20 500 3276800
318522156 Akshatgupta069_069 C May 5, 2025, 4:32 p.m. OK Java 8 TESTS 20 515 2867200
318572386 not_mohith C May 6, 2025, 2:41 a.m. OK Java 8 TESTS 20 718 0
318576418 parad512 C May 6, 2025, 3:56 a.m. OK Java 8 TESTS 20 718 4505600
318527419 harshchhallani3 C May 5, 2025, 4:47 p.m. OK Java 8 TESTS 20 780 0
318520924 ShengY C May 5, 2025, 4:28 p.m. OK Java 8 TESTS 20 968 0
318521525 Sergey.Bankevich C May 5, 2025, 4:30 p.m. OK Kotlin 1.7 TESTS 20 858 116940800
318523061 iitamansharma C May 5, 2025, 4:35 p.m. OK Kotlin 1.9 TESTS 20 468 21913600
318521595 ilez_ C May 5, 2025, 4:30 p.m. OK PyPy 3 TESTS 20 640 44032000
318579665 CRACKA C May 6, 2025, 4:54 a.m. OK PyPy 3 TESTS 20 780 21504000
318547535 pravith C May 5, 2025, 7:08 p.m. OK PyPy 3 TESTS 20 905 18841600
318578872 Katrina55553 C May 6, 2025, 4:40 a.m. OK PyPy 3-64 TESTS 20 203 28057600
318547198 pyorz C May 5, 2025, 7:04 p.m. OK PyPy 3-64 TESTS 20 234 27443200
318540924 Om_Singh_ C May 5, 2025, 6 p.m. OK PyPy 3-64 TESTS 20 249 26419200
318552879 fermion5 C May 5, 2025, 8:25 p.m. OK PyPy 3-64 TESTS 20 249 26726400
318539703 Om_Singh_ C May 5, 2025, 5:50 p.m. OK PyPy 3-64 TESTS 20 249 28569600
318545260 minuki646 C May 5, 2025, 6:43 p.m. OK PyPy 3-64 TESTS 20 249 29696000
318570009 fync02zxy C May 6, 2025, 1:47 a.m. OK PyPy 3-64 TESTS 20 264 28876800
318539168 Om_Singh_ C May 5, 2025, 5:46 p.m. OK PyPy 3-64 TESTS 20 265 28160000
318539878 Om_Singh_ C May 5, 2025, 5:51 p.m. OK PyPy 3-64 TESTS 20 265 28876800
318582962 hirose2020 C May 6, 2025, 5:40 a.m. OK PyPy 3-64 TESTS 20 280 27136000
318522893 XOptimus_PrimeX C May 5, 2025, 4:34 p.m. OK Python 3 TESTS 20 233 41472000
318522962 DPaper C May 5, 2025, 4:34 p.m. OK Python 3 TESTS 20 280 30208000
318538604 kon27 C May 5, 2025, 5:42 p.m. OK Python 3 TESTS 20 296 28876800
318582895 El-Qadi C May 6, 2025, 5:39 a.m. OK Python 3 TESTS 20 312 24780800
318526758 chansolpark7 C May 5, 2025, 4:45 p.m. OK Python 3 TESTS 20 358 36556800
318557485 LogiAce C May 5, 2025, 9:55 p.m. OK Python 3 TESTS 20 437 23756800
318520792 ayushdreams147 C May 5, 2025, 4:28 p.m. OK Python 3 TESTS 20 437 30105600
318524418 shahriarniloy14 C May 5, 2025, 4:38 p.m. OK Python 3 TESTS 20 452 23859200
318525139 m.olimovvv C May 5, 2025, 4:41 p.m. OK Python 3 TESTS 20 453 23756800
318520562 Varun12 C May 5, 2025, 4:27 p.m. OK Python 3 TESTS 20 453 35737600
318523343 jinaydeep2001 C May 5, 2025, 4:35 p.m. OK Rust 2021 TESTS 20 77 4096000
318579101 rishendraT C May 6, 2025, 4:44 a.m. OK Rust 2021 TESTS 20 93 13209600
318525669 ramialkawadri C May 5, 2025, 4:42 p.m. OK Rust 2021 TESTS 20 124 6860800
318568489 neulfox C May 6, 2025, 1:12 a.m. OK Rust 2021 TESTS 20 124 21811200
318568506 silicalet C May 6, 2025, 1:12 a.m. OK Rust 2021 TESTS 20 140 21811200

remove filters

Back to search problems