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 |
|---|---|---|---|---|---|---|
| 2227 | Codeforces Round 1096 (Div. 3) | FINISHED | False | 9000 | 3770705 | April 30, 2026, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 1954 ) | G | Drowning | PROGRAMMING | binary search data structures math |
Yousef has an array (a) consisting of (n) positive integers. He defines a reduction operation on any array (c) of length (|c| \ge 3): Choose an index (i) ((1 \lt i \lt |c|)) such that (c_{i-1} + c_{i+1} \gt c_i). Replace the triplet (\{c_{i-1}, c_i, c_{i+1}\}) with a single integer (x = c_{i-1} - c_i + c_{i+1}). The new integer (x) occupies the position previously held by the triplet, and the length of the array decreases by (2). An array is considered good if it can be reduced to a single element by performing the operation above zero or more times. Note that an array of length (1) is always good. Yousef wants you to count the number of pairs ((l, r)) ((1 \le l \le r \le n)) such that the subarray (al, r) is good. The first line contains an integer (t) ((1 \le t \le 10^4)) — the number of test cases. The description of each test case follows. The first line of each test case contains an integer (n) ((1 \le n \le 2 \cdot 10^5)) — the size of the array. The second line contains (n) integers (a_1, a_2, \dots, a_n) ((1 \le a_i \le 10^9)) — the elements of the array. 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 number of good subarrays. In the first example, (a = 10, 20, 10). Subarrays (10), (20), and (10) are all good ((3) total). The subarray (10, 20, 10) is not good. To reduce it, we must pick (i=2). The condition (a_1 + a_3 \gt a_2) becomes (10 + 10 \gt 20), which is (20 \gt 20) (false). In the second example, (a = 1, 1, 1, 1, 1): All (5) subarrays of length (1) are good. All (4) subarrays of length (2) are not good. All (3) subarrays of length (3) (which are (1, 1, 1)) are good because (1 + 1 \gt 1). All (2) subarrays of length (4) are not good. The subarray of length $$ |
| Codeforces Round 1096 (Div. 3) — Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 373157782 | Ron47 | G | April 30, 2026, 4:55 p.m. | OK | C# 13 | TESTS | 11 | 171 | 28160000 | ||
| 373150125 | whopassby_fan | G | April 30, 2026, 4:30 p.m. | OK | C# 13 | TESTS | 11 | 562 | 26214400 | ||
| 373162358 | Nitter | G | April 30, 2026, 5:14 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 78 | 0 | ||
| 373160044 | ketan_k_j | G | April 30, 2026, 5:02 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 78 | 29491200 | ||
| 373157221 | hawk-kun | G | April 30, 2026, 4:53 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 93 | 0 | ||
| 373161111 | variable. | G | April 30, 2026, 5:04 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 93 | 614400 | ||
| 373152614 | Mr-Habib-Abdul-Dayyan | G | April 30, 2026, 4:37 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 93 | 921600 | ||
| 373160209 | MutableSliceMutex | G | April 30, 2026, 5:02 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 93 | 2252800 | ||
| 373189481 | annekyl404 | G | May 1, 2026, 2:50 a.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 93 | 2560000 | ||
| 373154230 | LMQUAN969 | G | April 30, 2026, 4:43 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 93 | 2560000 | ||
| 373152393 | whysoserious123123 | G | April 30, 2026, 4:37 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 93 | 2560000 | ||
| 373191857 | ExtraStageLover | G | May 1, 2026, 3:47 a.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 93 | 8499200 |
Back to search problems