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 |
|---|---|---|---|---|---|---|
| 2176 | Codeforces Round 1070 (Div. 2) | FINISHED | False | 7200 | 10941923 | Dec. 11, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 1247 ) | E | Remove at the lowest cost | PROGRAMMING | data structures dfs and similar greedy implementation trees |
You have (n) elements. Each of these elements has a natural value (a_i) and a natural removal cost (c_i). You need to remove all elements except one, paying the minimum possible cost. To do this, you perform the following operation (n - 1) times: In one operation, you choose two adjacent elements and remove the one with the smaller value. For this operation, you pay the removal cost of the least expensive element among the two. If these two elements have equal values, you can remove either of them, paying the removal cost of the minimum of the two in terms of removal cost. After removing an element, the elements to the right of the removed element shift left by one position, leaving no gaps. You also have (n) zeroing operations for the removal costs of the array. After the (i)-th zeroing operation, the removal cost of the element with index (p_i) becomes (0). It is guaranteed that all (p_i) are distinct. You need to solve this problem for the original elements, as well as after each of the zeroing operations. Note: After the (i)-th zeroing operation, the removal cost of the element (p_i) remains (0) in all subsequent problems ((i + 1, i + 2, \dots, n)). 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 one natural number (n) ((2 \le n \le 2 \cdot 10^5)) — the number of elements you have. The second line of each test case contains (n) natural numbers (a_1, a_2, \ldots, a_n) ((1 \le a_i \le 10^9)) — the values of the elements. The third line of each test case contains (n) natural numbers (c_1, c_2, \ldots, c_n) ((1 \le c_i \le 10^9)) — the removal costs of the elements. The fourth line of each test case contains (n) natural numbers (p_1, p_2, \ldots, p_n) ((1 \le p_i \le n)) — the indices of the elements whos |
| Codeforces Round 1070 (Div.2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 353105049 | GTR.3910 | E | Dec. 11, 2025, 6:18 p.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 203 | 8294400 | ||
| 353130765 | JhdFarrell | E | Dec. 12, 2025, 1:43 a.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 234 | 8499200 | ||
| 353112389 | iliyan98 | E | Dec. 11, 2025, 7:18 p.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 234 | 27340800 | ||
| 353130949 | liyouran | E | Dec. 12, 2025, 1:49 a.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 250 | 11673600 | ||
| 353134099 | 4mDXc7yts8Nr | E | Dec. 12, 2025, 3:04 a.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 250 | 41779200 | ||
| 353136545 | ClarkW | E | Dec. 12, 2025, 3:51 a.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 281 | 13004800 | ||
| 353120054 | testuser_1751137592 | E | Dec. 11, 2025, 8:52 p.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 281 | 21811200 | ||
| 353091372 | peteza | E | Dec. 11, 2025, 4:31 p.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 281 | 33177600 | ||
| 353091967 | duongquanghai08 | E | Dec. 11, 2025, 4:32 p.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 296 | 21299200 | ||
| 353098672 | Salamnka | E | Dec. 11, 2025, 5:38 p.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 296 | 52224000 | ||
| 353136681 | inv1s1ble1 | E | Dec. 12, 2025, 3:53 a.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 156 | 9420800 | ||
| 353098488 | acccccccc | E | Dec. 11, 2025, 5:37 p.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 171 | 8192000 | ||
| 353106613 | Justinshao | E | Dec. 11, 2025, 6:28 p.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 171 | 18227200 | ||
| 353098366 | Intellegent | E | Dec. 11, 2025, 5:37 p.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 187 | 8192000 | ||
| 353128079 | Nyxanee | E | Dec. 12, 2025, 12:14 a.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 187 | 20070400 | ||
| 353136869 | zyn_615 | E | Dec. 12, 2025, 3:56 a.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 187 | 20889600 | ||
| 353083696 | a2coder | E | Dec. 11, 2025, 4:15 p.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 187 | 27443200 | ||
| 353145093 | acccccccc | E | Dec. 12, 2025, 5:30 a.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 187 | 40243200 | ||
| 353147253 | best_yue | E | Dec. 12, 2025, 5:54 a.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 203 | 43417600 | ||
| 353091197 | fengqiuqiuqiu | E | Dec. 11, 2025, 4:31 p.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 218 | 13209600 | ||
| 353129345 | Laceprndpm | E | Dec. 12, 2025, 12:59 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 33 | 140 | 12697600 | ||
| 353127470 | enslaved | E | Dec. 11, 2025, 11:50 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 33 | 140 | 17715200 | ||
| 353134127 | shendeliliang | E | Dec. 12, 2025, 3:05 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 33 | 156 | 21913600 | ||
| 353106697 | MartinRT | E | Dec. 11, 2025, 6:29 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 33 | 171 | 6348800 | ||
| 353147463 | WAhzh | E | Dec. 12, 2025, 5:56 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 33 | 171 | 16588800 | ||
| 353133414 | Lcyanstars | E | Dec. 12, 2025, 2:50 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 33 | 203 | 17305600 | ||
| 353098795 | addx | E | Dec. 11, 2025, 5:39 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 33 | 203 | 20070400 | ||
| 353140328 | lzyrapx | E | Dec. 12, 2025, 4:45 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 33 | 203 | 49766400 | ||
| 353090451 | BloodOfHades | E | Dec. 11, 2025, 4:30 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 33 | 218 | 28569600 | ||
| 353085412 | Mitsukasa_Ayase | E | Dec. 11, 2025, 4:19 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 33 | 218 | 29081600 | ||
| 353084212 | Suzal_Kori | E | Dec. 11, 2025, 4:16 p.m. | OK | Java 21 | TESTS | 33 | 546 | 28262400 | ||
| 353139145 | NanDemo | E | Dec. 12, 2025, 4:30 a.m. | OK | Java 21 | TESTS | 33 | 796 | 41369600 | ||
| 353092121 | SumitXorY | E | Dec. 11, 2025, 4:33 p.m. | OK | Java 21 | TESTS | 33 | 875 | 82124800 | ||
| 353099078 | lyongwolf | E | Dec. 11, 2025, 5:40 p.m. | OK | Java 21 | TESTS | 33 | 906 | 19251200 | ||
| 353124227 | vineetiwari | E | Dec. 11, 2025, 10:08 p.m. | OK | Java 21 | TESTS | 33 | 1062 | 40755200 | ||
| 353085360 | wenbozh | E | Dec. 11, 2025, 4:18 p.m. | OK | Java 21 | TESTS | 33 | 1078 | 74240000 | ||
| 353105080 | Yousef_Badr | E | Dec. 11, 2025, 6:18 p.m. | OK | Java 21 | TESTS | 33 | 1140 | 44236800 | ||
| 353104455 | Yousef_Badr | E | Dec. 11, 2025, 6:13 p.m. | OK | Java 21 | TESTS | 33 | 1171 | 41267200 | ||
| 353086093 | Syno. | E | Dec. 11, 2025, 4:20 p.m. | OK | Node.js | TESTS | 33 | 609 | 103219200 | ||
| 353120120 | DarkTemplarDrop | E | Dec. 11, 2025, 8:53 p.m. | OK | PyPy 3-64 | TESTS | 33 | 734 | 79974400 | ||
| 353142978 | Emikooh | E | Dec. 12, 2025, 5:17 a.m. | OK | PyPy 3-64 | TESTS | 33 | 796 | 100556800 | ||
| 353104296 | GeeTransit | E | Dec. 11, 2025, 6:12 p.m. | OK | PyPy 3-64 | TESTS | 33 | 968 | 99942400 | ||
| 353102370 | Infinite_Power | E | Dec. 11, 2025, 5:59 p.m. | OK | PyPy 3-64 | TESTS | 33 | 1031 | 58675200 | ||
| 353122782 | golomb | E | Dec. 11, 2025, 9:38 p.m. | OK | PyPy 3-64 | TESTS | 33 | 1156 | 60006400 | ||
| 353087632 | fermion5 | E | Dec. 11, 2025, 4:24 p.m. | OK | PyPy 3-64 | TESTS | 33 | 1343 | 167219200 | ||
| 353135320 | Hachikoo | E | Dec. 12, 2025, 3:28 a.m. | OK | Python 3 | TESTS | 33 | 796 | 73523200 | ||
| 353090047 | code_eraser | E | Dec. 11, 2025, 4:29 p.m. | OK | Python 3 | TESTS | 33 | 1234 | 186163200 | ||
| 353102689 | fermion5 | E | Dec. 11, 2025, 6:01 p.m. | OK | Python 3 | TESTS | 33 | 2125 | 113561600 |
Back to search problems