Codeforces Round 1082 (Div. 1)

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.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 10787 ) A1 Lost Civilization (Easy Version) PROGRAMMING data structures

This is the easy version of the problem. The difference between the versions is that in this version, you must compute a value for one sequence. 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. Given a sequence (a) of (n) integers, determine the length of the shortest sequence that could be given as an input for the algorithm to generate (a). 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)). The second line of each test case contains (n) integers (a_1,a_2,\ldots,a_n) ((1 \le a_i \le 10^9)). It is guaranteed that the sum of (n) over all test cases does not exceed (300\,000). For each test case, output the length of the shortest sequence on a separate line. In the first test case, the sequence (1) can generate the sequence (a=1,2,3,4,5) by the following process: ()1 \to 1,\color{red}{2} \to 1,2,\color{red}{3} \to 1,2,3,\color{red}{4} \to 1,2,3,4,\color{red}{5}() In the second test case, the only sequence that can generate (a=1,3,5,7,9) is (a) itself.

Tutorials

Codeforces Round 1082 (Div. 1, Div. 2) Complete Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
364044433 -firefly- A1 Feb. 23, 2026, 2:50 p.m. OK C# 13 TESTS 18 187 15155200
364067276 yizhigop A1 Feb. 23, 2026, 3:27 p.m. OK C++17 (GCC 7-32) TESTS 18 78 1228800
364110084 GabrielCampelo A1 Feb. 23, 2026, 6:12 p.m. OK C++17 (GCC 7-32) TESTS 18 93 0
364109083 GabrielCampelo A1 Feb. 23, 2026, 6:03 p.m. OK C++17 (GCC 7-32) TESTS 18 93 0
364108939 Treks A1 Feb. 23, 2026, 6:02 p.m. OK C++17 (GCC 7-32) TESTS 18 93 0
364055719 lacito A1 Feb. 23, 2026, 3:07 p.m. OK C++17 (GCC 7-32) TESTS 18 93 0
364040820 how_to_solve_D_Div2 A1 Feb. 23, 2026, 2:45 p.m. OK C++17 (GCC 7-32) TESTS 18 93 0
364146928 dkedu A1 Feb. 24, 2026, 3:49 a.m. OK C++17 (GCC 7-32) TESTS 18 93 102400
364143961 AII_Might A1 Feb. 24, 2026, 2:54 a.m. OK C++17 (GCC 7-32) TESTS 18 93 102400
364143779 noobcoder_ravii A1 Feb. 24, 2026, 2:50 a.m. OK C++17 (GCC 7-32) TESTS 18 93 102400
364140516 shadow9236 A1 Feb. 24, 2026, 1:38 a.m. OK C++17 (GCC 7-32) TESTS 18 93 102400
364045524 threethreetwothree A1 Feb. 23, 2026, 2:52 p.m. OK C++20 (GCC 13-64) TESTS 18 46 12492800
364053386 Ruliea_ A1 Feb. 23, 2026, 3:03 p.m. OK C++20 (GCC 13-64) TESTS 18 62 6144000
364033789 LACC A1 Feb. 23, 2026, 2:39 p.m. OK C++20 (GCC 13-64) TESTS 18 78 0
364155367 FatihCihan A1 Feb. 24, 2026, 6:06 a.m. OK C++20 (GCC 13-64) TESTS 18 78 102400
364052208 ivan_dudi A1 Feb. 23, 2026, 3:02 p.m. OK C++20 (GCC 13-64) TESTS 18 78 102400
364051173 The_Cryptic_TG A1 Feb. 23, 2026, 3 p.m. OK C++20 (GCC 13-64) TESTS 18 78 102400
364048567 JedbyKey999 A1 Feb. 23, 2026, 2:56 p.m. OK C++20 (GCC 13-64) TESTS 18 78 102400
364042136 Announcement A1 Feb. 23, 2026, 2:47 p.m. OK C++20 (GCC 13-64) TESTS 18 78 102400
364041430 Apteryxx A1 Feb. 23, 2026, 2:46 p.m. OK C++20 (GCC 13-64) TESTS 18 78 102400
364039111 Natsuzora A1 Feb. 23, 2026, 2:43 p.m. OK C++20 (GCC 13-64) TESTS 18 78 102400
364039292 permutation A1 Feb. 23, 2026, 2:43 p.m. OK C++23 (GCC 14-64, msys2) TESTS 18 46 102400
364043210 tickcross.y A1 Feb. 23, 2026, 2:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 18 46 4608000
364035458 csp1025 A1 Feb. 23, 2026, 2:41 p.m. OK C++23 (GCC 14-64, msys2) TESTS 18 46 5017600
364041738 flowing_boat A1 Feb. 23, 2026, 2:47 p.m. OK C++23 (GCC 14-64, msys2) TESTS 18 46 7577600
364040419 iforandom A1 Feb. 23, 2026, 2:45 p.m. OK C++23 (GCC 14-64, msys2) TESTS 18 46 34201600
364036027 MrPython A1 Feb. 23, 2026, 2:42 p.m. OK C++23 (GCC 14-64, msys2) TESTS 18 62 0
364035542 thr_c2025 A1 Feb. 23, 2026, 2:41 p.m. OK C++23 (GCC 14-64, msys2) TESTS 18 62 102400
364049543 yllls A1 Feb. 23, 2026, 2:58 p.m. OK C++23 (GCC 14-64, msys2) TESTS 18 62 1228800
364045433 miscalculation53 A1 Feb. 23, 2026, 2:52 p.m. OK C++23 (GCC 14-64, msys2) TESTS 18 62 5529600
364064263 Sakura_xyz A1 Feb. 23, 2026, 3:21 p.m. OK C++23 (GCC 14-64, msys2) TESTS 18 78 0
364038264 Gassa A1 Feb. 23, 2026, 2:43 p.m. OK D TESTS 18 156 15974400
364130995 abdallahyac06 A1 Feb. 23, 2026, 10 p.m. OK GNU C11 TESTS 18 109 1228800
364057378 pengin_2000 A1 Feb. 23, 2026, 3:10 p.m. OK GNU C11 TESTS 18 171 7270400
364060345 omaltsev A1 Feb. 23, 2026, 3:15 p.m. OK Haskell TESTS 18 1453 116633600
364148969 sathwikhbhat A1 Feb. 24, 2026, 4:26 a.m. OK Java 21 TESTS 18 250 6963200
364148785 GuLLu05 A1 Feb. 24, 2026, 4:22 a.m. OK Java 21 TESTS 18 312 6348800
364078828 lybord A1 Feb. 23, 2026, 3:52 p.m. OK Java 21 TESTS 18 328 819200
364146438 daniel.glabai A1 Feb. 24, 2026, 3:40 a.m. OK Java 21 TESTS 18 421 30310400
364147096 akshatkotecha A1 Feb. 24, 2026, 3:52 a.m. OK Java 21 TESTS 18 781 2457600
364041735 NeelmaniPandey09 A1 Feb. 23, 2026, 2:47 p.m. OK Java 8 TESTS 18 187 13516800
364035214 Tlatoani A1 Feb. 23, 2026, 2:41 p.m. OK Kotlin 2.2 TESTS 18 453 55705600
364057036 bcollet A1 Feb. 23, 2026, 3:09 p.m. OK PyPy 2 TESTS 18 203 22323200
364041925 Emikooh A1 Feb. 23, 2026, 2:47 p.m. OK PyPy 3-64 TESTS 18 125 44544000
364046753 Nikrien A1 Feb. 23, 2026, 2:54 p.m. OK PyPy 3-64 TESTS 18 140 40038400
364043437 hugoback01 A1 Feb. 23, 2026, 2:49 p.m. OK PyPy 3-64 TESTS 18 140 43110400
364034936 LLM A1 Feb. 23, 2026, 2:40 p.m. OK PyPy 3-64 TESTS 18 140 44441600
364035685 p_a_r_k_j_u_n_e A1 Feb. 23, 2026, 2:42 p.m. OK PyPy 3-64 TESTS 18 140 44646400
364146634 DarkTemplarDrop A1 Feb. 24, 2026, 3:44 a.m. OK PyPy 3-64 TESTS 18 140 47718400
364152430 MengxinWalkingGrass A1 Feb. 24, 2026, 5:26 a.m. OK PyPy 3-64 TESTS 18 156 28160000
364036531 teekaytai A1 Feb. 23, 2026, 2:43 p.m. OK PyPy 3-64 TESTS 18 156 28160000
364039415 swlee0202 A1 Feb. 23, 2026, 2:43 p.m. OK PyPy 3-64 TESTS 18 156 35840000
364041544 yupooh A1 Feb. 23, 2026, 2:46 p.m. OK PyPy 3-64 TESTS 18 156 36249600
364040981 Jimanbanashi A1 Feb. 23, 2026, 2:46 p.m. OK Python 2 TESTS 18 390 15462400
364117010 alexruzzi98 A1 Feb. 23, 2026, 7:18 p.m. OK Python 3 TESTS 18 218 40345600
364040625 Solalyth A1 Feb. 23, 2026, 2:45 p.m. OK Rust 2021 TESTS 18 62 20582400
364035197 DanielAnker A1 Feb. 23, 2026, 2:41 p.m. OK Rust 2024 TESTS 18 46 17203200
364039135 Darknef A1 Feb. 23, 2026, 2:43 p.m. OK Rust 2024 TESTS 18 62 3481600
364045976 Mon_ster A1 Feb. 23, 2026, 2:53 p.m. OK Rust 2024 TESTS 18 62 11673600
364055871 mertyilmaz A1 Feb. 23, 2026, 3:07 p.m. OK Rust 2024 TESTS 18 109 40857600

remove filters

Back to search problems