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 |
|---|---|---|---|---|---|---|
| 2201 | Codeforces Round 1082 (Div. 1) | FINISHED | False | 9000 | 4548323 | Feb. 23, 2026, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 4972 ) | A2 | Lost Civilization (Hard Version) | PROGRAMMING | data structures dp |
This is the hard version of the problem. The difference between the versions is that in this version, you must compute the sum of values over all subsegments. You can hack only if you solved all versions of this problem. Let's define an algorithm to generate a sequence of (m+k) integers as follows: First, receive a sequence (x) of (m) integers as input. If (k=0), terminate immediately and return the sequence (x). Then, select any index (1 \le i \le |x|) and insert ((x_i+1)) immediately after the element (x_i). If (x) contains exactly (m+k) integers, terminate and return the sequence (x). Otherwise, return to the second step. Alice knows that this algorithm was used by an ancient civilization in order to hide their secrets safely. Alice wants to learn the knowledge that they wanted to hide, but it is not an easy job to infer the input from the output of the algorithm. For a sequence (b) of (n) integers, let us define (f(b)) as the length of the shortest sequence that could be given as an input for the algorithm to generate (b). Given a sequence (a) of (n) integers, please compute the value of the following sum ()\sum_{l=1}^n {\sum_{r=l}^n {f(a_l,a_{l+1},\ldots,a_r)}}() In other words, you must find the sum of (f(c)) over all subsegments (^{\text{∗}}) (c) of (a). (^{\text{∗}})A sequence (a) is a subsegment of a sequence (b) if (a) can be obtained from (b) by the deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end. Two subsegments are considered different if the sets of positions of the deleted elements are different. 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 a single integer (n) ($$$1 \le n \le 300\,000 |
| Codeforces Round 1082 (Div. 1, Div. 2) Complete Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 364048171 | -firefly- | A2 | Feb. 23, 2026, 2:56 p.m. | OK | C# 13 | TESTS | 18 | 171 | 17612800 | ||
| 364047787 | lucri | A2 | Feb. 23, 2026, 2:55 p.m. | OK | C++17 (GCC 7-32) | TESTS | 18 | 93 | 2457600 | ||
| 364050742 | middle_man | A2 | Feb. 23, 2026, 2:59 p.m. | OK | C++17 (GCC 7-32) | TESTS | 18 | 93 | 4096000 | ||
| 364143983 | AII_Might | A2 | Feb. 24, 2026, 2:54 a.m. | OK | C++17 (GCC 7-32) | TESTS | 19 | 93 | 5324800 | ||
| 364150938 | dkedu | A2 | Feb. 24, 2026, 5 a.m. | OK | C++17 (GCC 7-32) | TESTS | 19 | 93 | 7270400 | ||
| 364061592 | l-_-l | A2 | Feb. 23, 2026, 3:17 p.m. | OK | C++17 (GCC 7-32) | TESTS | 18 | 109 | 0 | ||
| 364144867 | shadow9236 | A2 | Feb. 24, 2026, 3:11 a.m. | OK | C++17 (GCC 7-32) | TESTS | 19 | 109 | 102400 | ||
| 364058402 | Swistakk | A2 | Feb. 23, 2026, 3:12 p.m. | OK | C++17 (GCC 7-32) | TESTS | 18 | 109 | 102400 | ||
| 364049913 | Karuk | A2 | Feb. 23, 2026, 2:58 p.m. | OK | C++17 (GCC 7-32) | TESTS | 18 | 109 | 102400 | ||
| 364049167 | Because_I_Love_You | A2 | Feb. 23, 2026, 2:57 p.m. | OK | C++17 (GCC 7-32) | TESTS | 18 | 109 | 102400 | ||
| 364044271 | Potassium | A2 | Feb. 23, 2026, 2:50 p.m. | OK | C++17 (GCC 7-32) | TESTS | 18 | 109 | 102400 | ||
| 364064295 | Ruliea_ | A2 | Feb. 23, 2026, 3:22 p.m. | OK | C++20 (GCC 13-64) | TESTS | 18 | 62 | 7065600 | ||
| 364053335 | threethreetwothree | A2 | Feb. 23, 2026, 3:03 p.m. | OK | C++20 (GCC 13-64) | TESTS | 18 | 62 | 32460800 | ||
| 364047497 | Xellos | A2 | Feb. 23, 2026, 2:55 p.m. | OK | C++20 (GCC 13-64) | TESTS | 18 | 78 | 0 | ||
| 364049284 | NotOnlySuccess | A2 | Feb. 23, 2026, 2:57 p.m. | OK | C++20 (GCC 13-64) | TESTS | 18 | 78 | 102400 | ||
| 364048797 | ya_ssh | A2 | Feb. 23, 2026, 2:57 p.m. | OK | C++20 (GCC 13-64) | TESTS | 18 | 78 | 102400 | ||
| 364042407 | LaRagde | A2 | Feb. 23, 2026, 2:48 p.m. | OK | C++20 (GCC 13-64) | TESTS | 18 | 78 | 102400 | ||
| 364035662 | EnuTieTie | A2 | Feb. 23, 2026, 2:42 p.m. | OK | C++20 (GCC 13-64) | TESTS | 18 | 78 | 1228800 | ||
| 364053363 | AmShZ | A2 | Feb. 23, 2026, 3:03 p.m. | OK | C++20 (GCC 13-64) | TESTS | 18 | 78 | 1536000 | ||
| 364150952 | Kobe_Bryant_Laoda | A2 | Feb. 24, 2026, 5 a.m. | OK | C++20 (GCC 13-64) | TESTS | 19 | 78 | 3379200 | ||
| 364145700 | Alasco | A2 | Feb. 24, 2026, 3:27 a.m. | OK | C++20 (GCC 13-64) | TESTS | 19 | 93 | 0 | ||
| 364057269 | miscalculation53 | A2 | Feb. 23, 2026, 3:10 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 18 | 46 | 6246400 | ||
| 364040033 | csp1025 | A2 | Feb. 23, 2026, 2:44 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 18 | 62 | 5017600 | ||
| 364041387 | tickcross.y | A2 | Feb. 23, 2026, 2:46 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 18 | 62 | 9318400 | ||
| 364048650 | iforandom | A2 | Feb. 23, 2026, 2:57 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 18 | 62 | 42291200 | ||
| 364059087 | NotDWT | A2 | Feb. 23, 2026, 3:13 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 18 | 78 | 0 | ||
| 364051774 | ksun48 | A2 | Feb. 23, 2026, 3:01 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 18 | 78 | 0 | ||
| 364120095 | MR_NoSolution | A2 | Feb. 23, 2026, 7:52 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 19 | 78 | 102400 | ||
| 364041586 | tabr | A2 | Feb. 23, 2026, 2:46 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 18 | 78 | 102400 | ||
| 364053592 | alzahrawi | A2 | Feb. 23, 2026, 3:04 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 18 | 78 | 409600 | ||
| 364051663 | Serendipity__ | A2 | Feb. 23, 2026, 3:01 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 18 | 78 | 1024000 | ||
| 364072611 | Gassa | A2 | Feb. 23, 2026, 3:38 p.m. | OK | D | TESTS | 18 | 187 | 26419200 | ||
| 364067843 | pengin_2000 | A2 | Feb. 23, 2026, 3:28 p.m. | OK | GNU C11 | TESTS | 18 | 265 | 14438400 | ||
| 364068165 | omaltsev | A2 | Feb. 23, 2026, 3:29 p.m. | OK | Haskell | TESTS | 18 | 1421 | 116736000 | ||
| 364141310 | godAngryOver | A2 | Feb. 24, 2026, 1:56 a.m. | OK | Java 21 | TESTS | 19 | 328 | 6451200 | ||
| 364140502 | godAngryOver | A2 | Feb. 24, 2026, 1:38 a.m. | OK | Java 21 | TESTS | 19 | 328 | 7680000 | ||
| 364092123 | lybord | A2 | Feb. 23, 2026, 4:28 p.m. | OK | Java 21 | TESTS | 18 | 468 | 22732800 | ||
| 364147026 | daniel.glabai | A2 | Feb. 24, 2026, 3:51 a.m. | OK | Java 21 | TESTS | 19 | 500 | 31539200 | ||
| 364049441 | NeelmaniPandey09 | A2 | Feb. 23, 2026, 2:58 p.m. | OK | Java 8 | TESTS | 18 | 218 | 13516800 | ||
| 364039477 | Tlatoani | A2 | Feb. 23, 2026, 2:44 p.m. | OK | Kotlin 2.2 | TESTS | 18 | 468 | 55705600 | ||
| 364065236 | bcollet | A2 | Feb. 23, 2026, 3:23 p.m. | OK | PyPy 2 | TESTS | 18 | 218 | 23449600 | ||
| 364053565 | Emikooh | A2 | Feb. 23, 2026, 3:04 p.m. | OK | PyPy 3-64 | TESTS | 18 | 140 | 30822400 | ||
| 364049013 | teekaytai | A2 | Feb. 23, 2026, 2:57 p.m. | OK | PyPy 3-64 | TESTS | 18 | 156 | 28057600 | ||
| 364057307 | Ergodic137 | A2 | Feb. 23, 2026, 3:10 p.m. | OK | PyPy 3-64 | TESTS | 18 | 156 | 44339200 | ||
| 364045788 | p_a_r_k_j_u_n_e | A2 | Feb. 23, 2026, 2:52 p.m. | OK | PyPy 3-64 | TESTS | 18 | 156 | 44339200 | ||
| 364035581 | toam | A2 | Feb. 23, 2026, 2:41 p.m. | OK | PyPy 3-64 | TESTS | 18 | 171 | 40550400 | ||
| 364044100 | twosquares | A2 | Feb. 23, 2026, 2:50 p.m. | OK | PyPy 3-64 | TESTS | 18 | 171 | 41676800 | ||
| 364046144 | Jank | A2 | Feb. 23, 2026, 2:53 p.m. | OK | PyPy 3-64 | TESTS | 18 | 187 | 40652800 | ||
| 364048335 | detteiuu | A2 | Feb. 23, 2026, 2:56 p.m. | OK | PyPy 3-64 | TESTS | 18 | 187 | 43929600 | ||
| 364050653 | hugoback01 | A2 | Feb. 23, 2026, 2:59 p.m. | OK | PyPy 3-64 | TESTS | 18 | 187 | 44544000 | ||
| 364043088 | alexwice | A2 | Feb. 23, 2026, 2:49 p.m. | OK | PyPy 3-64 | TESTS | 18 | 187 | 47104000 | ||
| 364042528 | Jimanbanashi | A2 | Feb. 23, 2026, 2:48 p.m. | OK | Python 2 | TESTS | 18 | 453 | 15360000 | ||
| 364043940 | Solalyth | A2 | Feb. 23, 2026, 2:50 p.m. | OK | Rust 2021 | TESTS | 18 | 62 | 20480000 | ||
| 364044069 | Darknef | A2 | Feb. 23, 2026, 2:50 p.m. | OK | Rust 2024 | TESTS | 18 | 46 | 15052800 | ||
| 364043793 | DanielAnker | A2 | Feb. 23, 2026, 2:49 p.m. | OK | Rust 2024 | TESTS | 18 | 62 | 17203200 | ||
| 364048673 | Mon_ster | A2 | Feb. 23, 2026, 2:57 p.m. | OK | Rust 2024 | TESTS | 18 | 62 | 26214400 | ||
| 364115949 | mertyilmaz | A2 | Feb. 23, 2026, 7:08 p.m. | OK | Rust 2024 | TESTS | 19 | 93 | 40857600 |
Back to search problems