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 |
|---|---|---|---|---|---|---|
| 2089 | Codeforces Round 1012 (Div. 1) | FINISHED | False | 9000 | 33697523 | March 23, 2025, 5:35 a.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 186 ) | D | Conditional Operators | PROGRAMMING | constructive algorithms |
In C++, the conditional operator ?: is used as the value of x?y:z is (y) if (x) is true; otherwise, the value is (z). (x), (y), and (z) may also be expressions. It is right-associated; that is, a?b:c?d:e is equivalent to a?b:(c?d:e) . (0) means false and (1) means true. Given a binary string with length (2n+1), you need to show whether the value of the expression can be (1) after inserting (n) conditional operators into the string. You can use parentheses. For example, the string 10101 can be transformed into (1?0:1)?0:1 , whose value is (1). The first line contains a single integer (t) ((1 \le t \le 10\,000)), the number of test cases. The description of the test cases follows. In the first line of each test case, there is a single integer (n) ((1 \le n \le 1.5 \cdot 10^5)). In the second line of each test case, there is a binary string of length (2n + 1). It is guaranteed that the sum of (n) across all test cases does not exceed (1.5 \cdot 10^5). For each test case, on the first line, output Yes if the string can be transformed into an expression of value (1); otherwise, output No . If the answer is Yes , output the expression on the second line. You can use parentheses, but the order of the characters in the original string must remain the same. The length of your expression must be no more than (10n+1000). The first test case — is the one mentioned in the problem description. In the second test case, it is clear that regardless of how the conditional operator is used, the result will always be zero. |
| Codeforces Round 1012 (Div.1, Div. 2, based on THUPC 2025 — Finals) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 312136484 | Coffins | D | March 24, 2025, 2:44 a.m. | OK | C++17 (GCC 7-32) | TESTS | 44 | 93 | 108953600 | ||
| 312088446 | cdxcdxcdxcdx | D | March 23, 2025, 3:08 p.m. | OK | C++17 (GCC 7-32) | TESTS | 44 | 108 | 34816000 | ||
| 312090585 | cdxcdxcdxcdx | D | March 23, 2025, 3:28 p.m. | OK | C++17 (GCC 7-32) | TESTS | 44 | 109 | 34713600 | ||
| 312127289 | A_G | D | March 23, 2025, 11:09 p.m. | OK | C++20 (GCC 13-64) | TESTS | 44 | 62 | 102400 | ||
| 312109239 | SinhaSatwik | D | March 23, 2025, 6:32 p.m. | OK | C++20 (GCC 13-64) | TESTS | 44 | 62 | 1126400 | ||
| 312130862 | rqoi031 | D | March 24, 2025, 12:44 a.m. | OK | C++20 (GCC 13-64) | TESTS | 44 | 77 | 23347200 | ||
| 312030790 | JDScript0117 | D | March 23, 2025, 8:02 a.m. | OK | C++20 (GCC 13-64) | TESTS | 44 | 108 | 2457600 | ||
| 312030778 | sevlll777 | D | March 23, 2025, 8:02 a.m. | OK | C++20 (GCC 13-64) | TESTS | 44 | 108 | 23347200 | ||
| 312056542 | JDScript0117 | D | March 23, 2025, 10:54 a.m. | OK | C++20 (GCC 13-64) | TESTS | 44 | 124 | 2457600 | ||
| 312005425 | tourist | D | March 23, 2025, 6:56 a.m. | OK | C++20 (GCC 13-64) | TESTS | 44 | 124 | 23142400 | ||
| 312123387 | turkhuu622 | D | March 23, 2025, 9:37 p.m. | OK | C++20 (GCC 13-64) | TESTS | 44 | 124 | 27648000 | ||
| 312037829 | lichenghan | D | March 23, 2025, 8:49 a.m. | OK | C++20 (GCC 13-64) | TESTS | 44 | 124 | 78848000 | ||
| 312085096 | 18Michael | D | March 23, 2025, 2:39 p.m. | OK | C++20 (GCC 13-64) | TESTS | 44 | 171 | 32256000 | ||
| 312064896 | Kilo_5723 | D | March 23, 2025, 11:56 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 44 | 61 | 102400 | ||
| 312104413 | DevdGamer | D | March 23, 2025, 5:45 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 44 | 62 | 819200 | ||
| 312065594 | Kilo_5723 | D | March 23, 2025, 12:01 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 44 | 62 | 819200 | ||
| 312065176 | Kilo_5723 | D | March 23, 2025, 11:58 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 44 | 62 | 819200 | ||
| 312019023 | ksun48 | D | March 23, 2025, 7:32 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 44 | 62 | 921600 | ||
| 312012646 | ecnerwala | D | March 23, 2025, 7:15 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 44 | 77 | 102400 | ||
| 312035983 | ecnerwala | D | March 23, 2025, 8:39 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 44 | 78 | 102400 | ||
| 312035835 | Keshi | D | March 23, 2025, 8:38 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 44 | 93 | 11878400 | ||
| 312054855 | LJC00118 | D | March 23, 2025, 10:42 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 44 | 109 | 23244800 | ||
| 312138027 | cooluo | D | March 24, 2025, 3:14 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 44 | 109 | 37478400 | ||
| 312022408 | Tlatoani | D | March 23, 2025, 7:41 a.m. | OK | Kotlin 1.9 | TESTS | 44 | 249 | 716800 | ||
| 312107741 | arvindf232 | D | March 23, 2025, 6:18 p.m. | OK | Kotlin 1.9 | TESTS | 44 | 562 | 37580800 |
Back to search problems