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 |
|---|---|---|---|---|---|---|
| 2231 | Codeforces Round 1099 (Div. 2) | FINISHED | False | 7200 | 2301902 | May 21, 2026, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 3338 ) | D | Maximum Prefix Sums | PROGRAMMING | constructive algorithms greedy implementation two pointers |
521 sounds the same as "I love you" in Chinese. On this special day, Little S wants to give Little A some well-prepared sequences to recall their friendship sealed for years. Little S has prepared an array (a_1, a_2, \ldots, a_n). Let's define its prefix sums array (b_1, b_2, \ldots, b_n), where (b_i = a_1 + a_2 + \ldots + a_i). Also define the prefix maximum array of (b): (c_1, c_2, \ldots, c_n), where (c_i = \max(b_1, b_2, \ldots, b_i)). Now array (a) has been partially lost, but luckily Little S still keeps the array (c). Your task is to restore the array (a) and send it to Little A, or report that no such array exists — in this case, the kind and cute Little A won't get mad either. Formally, you are given a binary string (s), a partially filled array (a), and an array (c), where: If you remember the value of (a_i), then (s_i = 1), and you are given the true value of (a_i). If you do not remember the value of (a_i), then (s_i = 0), and you are given (a_i = 0). 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 an integer (n) ((1 \le n \le 2 \cdot 10^5)). The second line of each test case contains a binary string (s) ((s_i \in \{0, 1\})) of length (n). The third line of each test case contains (n) integers (a_1, a_2, \ldots, a_n) ((|a_i| \le 10^6)). If (s_i = 0), then it is guaranteed that (a_i = 0). The fourth line of each test case contains (n) integers (c_1, c_2, \ldots, c_n) ((|c_i| \le 2 \cdot 10^{11})). It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, print " Yes " in the first line if the array (a) exists, otherwise print " No ". You may print the answer in any case. For exa |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 375544751 | _Equinox | D | May 21, 2026, 4:23 p.m. | OK | C# 13 | TESTS | 15 | 187 | 22016000 |
Back to search problems