Codeforces Round 1085 (Div. 1 + Div. 2)

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
2207 Codeforces Round 1085 (Div. 1 + Div. 2) FINISHED False 10800 3425123 March 8, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1598 ) E1 N-MEX (Constructive Version) PROGRAMMING constructive algorithms greedy

This is the constructive version of the problem. The difference between the versions is that in this version, you need to either construct an answer or report that it is impossible, and (0 \leq b_i \leq 10^9). You can hack only if you solved all versions of this problem. The Master Builder doesn't like repetitive tasks — repairing the base, upgrading the town hall fifteen times, and doing yet more programming problems about MEX. So, this is not going to be your ordinary MEX problem. For any positive integer (k), define the (k)-mex of a collection of integers (S) to be the (k)-th smallest nonnegative integer not present in (S). For instance, the (1)-mex and (2)-mex of (1, 2, 1) are (0) and (3), respectively. Let (n) be a positive integer, and consider an array of nonnegative integers (a_1, \ldots, a_n). Determine whether or not there exists an array of nonnegative integers (b_1, \ldots, b_n) such that: For all (1 \leq i \leq n), the ((n-i+1))-mex of (b_1, \ldots, b_i) is (a_i). 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 \leq n \leq 2 \cdot 10^5)) — the length of the array (a). The second line of each test case contains (n) integers (a_1, \ldots, a_n) ((0 \leq a_i \leq 10^9)). It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, print a line containing either " YES " or " NO ", representing whether or not the array (b) exists. You can output the answer in any case (upper or lower). For example, the strings " yEs ", " yes ", " Yes ", and " YES " will be recognized as positive responses. Then, if you responded with " YES ", print a second line containing (n) integers (b_1, \ldots, b_n) ($$$0 \leq

Tutorials

Codeforces Round 1085 (Div. 1 + Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
365900379 Ryuzaki4657 E1 March 8, 2026, 5:26 p.m. OK C++17 (GCC 7-32) TESTS 15 78 0
365896943 Tian_Ming_Yo E1 March 8, 2026, 5:06 p.m. OK C++17 (GCC 7-32) TESTS 15 78 0
365887317 mickeyjung E1 March 8, 2026, 4:12 p.m. OK C++17 (GCC 7-32) TESTS 15 78 102400
365940539 mickeyjung E1 March 9, 2026, 5:24 a.m. OK C++17 (GCC 7-32) TESTS 16 78 307200
365912400 888313666 E1 March 8, 2026, 7:38 p.m. OK C++17 (GCC 7-32) TESTS 16 93 0
365899000 _small_fish E1 March 8, 2026, 5:18 p.m. OK C++17 (GCC 7-32) TESTS 15 93 0
365888866 epsilon_xd E1 March 8, 2026, 4:20 p.m. OK C++17 (GCC 7-32) TESTS 15 93 0
365886378 pinerush E1 March 8, 2026, 4:08 p.m. OK C++17 (GCC 7-32) TESTS 15 93 0
365896257 BhaiSom23 E1 March 8, 2026, 5:02 p.m. OK C++17 (GCC 7-32) TESTS 15 93 102400
365887735 supervillain E1 March 8, 2026, 4:15 p.m. OK C++17 (GCC 7-32) TESTS 15 93 102400
365941695 Ph00en1X E1 March 9, 2026, 5:40 a.m. OK C++20 (GCC 13-64) TESTS 16 62 102400
365890413 ItsNotMeItsYou E1 March 8, 2026, 4:29 p.m. OK C++20 (GCC 13-64) TESTS 15 62 102400
365895790 KIRIJIJI E1 March 8, 2026, 4:59 p.m. OK C++20 (GCC 13-64) TESTS 15 62 1638400
365899510 synthborne E1 March 8, 2026, 5:21 p.m. OK C++20 (GCC 13-64) TESTS 15 62 3481600
365926790 timg8710 E1 March 8, 2026, 11:55 p.m. OK C++20 (GCC 13-64) TESTS 16 78 0
365908323 cockatooo_2025GM E1 March 8, 2026, 6:47 p.m. OK C++20 (GCC 13-64) TESTS 16 78 0
365887688 Rainmaker2627 E1 March 8, 2026, 4:14 p.m. OK C++20 (GCC 13-64) TESTS 15 78 0
365884485 Rubikun E1 March 8, 2026, 3:58 p.m. OK C++20 (GCC 13-64) TESTS 15 78 0
365904835 Zheng_iii E1 March 8, 2026, 6:07 p.m. OK C++20 (GCC 13-64) TESTS 15 78 102400
365900598 turska E1 March 8, 2026, 5:27 p.m. OK C++20 (GCC 13-64) TESTS 15 78 102400
365896760 miscalculation53 E1 March 8, 2026, 5:05 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 46 4403200
365904213 awoo E1 March 8, 2026, 6:02 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 62 204800
365881580 maspy E1 March 8, 2026, 3:45 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 62 2252800
365894184 robertfan E1 March 8, 2026, 4:50 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 62 3276800
365892751 Kolychestiy E1 March 8, 2026, 4:42 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 62 5324800
365931471 012345 E1 March 9, 2026, 2:18 a.m. OK C++23 (GCC 14-64, msys2) TESTS 16 78 0
365927064 cran E1 March 9, 2026, 12:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 16 78 0
365911652 dremlory E1 March 8, 2026, 7:29 p.m. OK C++23 (GCC 14-64, msys2) TESTS 16 78 0
365905673 rgnerdplayer E1 March 8, 2026, 6:15 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 78 0
365902263 LNight121 E1 March 8, 2026, 5:34 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 78 0
365894844 EROR E1 March 8, 2026, 4:54 p.m. OK Go TESTS 15 109 6553600
365889660 the_atul_gour E1 March 8, 2026, 4:25 p.m. OK Java 21 TESTS 15 296 7065600
365904050 knightL E1 March 8, 2026, 6:01 p.m. OK Java 21 TESTS 15 312 1843200
365889368 lohan007 E1 March 8, 2026, 4:23 p.m. OK Java 21 TESTS 15 328 8089600
365888616 jdltc E1 March 8, 2026, 4:19 p.m. OK Java 21 TESTS 15 375 2048000
365886638 Preetham_22 E1 March 8, 2026, 4:09 p.m. OK Java 21 TESTS 15 656 41267200
365898380 vinamrat4 E1 March 8, 2026, 5:14 p.m. OK Java 21 TESTS 15 718 41676800
365883570 elprimo2003 E1 March 8, 2026, 3:54 p.m. OK Java 21 TESTS 15 734 2457600
365901740 nullbrain_ E1 March 8, 2026, 5:33 p.m. OK Kotlin 2.2 TESTS 15 156 28876800
365878691 Tlatoani E1 March 8, 2026, 3:32 p.m. OK Kotlin 2.2 TESTS 15 453 41472000
365907287 bu_gye_jeong E1 March 8, 2026, 6:33 p.m. OK Node.js TESTS 16 171 45465600
365890280 SanjarAlgo E1 March 8, 2026, 4:28 p.m. OK PascalABC.NET TESTS 15 625 6656000
365895973 Only365 E1 March 8, 2026, 5 p.m. OK PyPy 3-64 TESTS 15 171 25395200
365897056 Ergodic137 E1 March 8, 2026, 5:07 p.m. OK PyPy 3-64 TESTS 15 171 28364800
365900233 bhavinsg02 E1 March 8, 2026, 5:25 p.m. OK PyPy 3-64 TESTS 15 171 28876800
365889888 LeonVir E1 March 8, 2026, 4:26 p.m. OK PyPy 3-64 TESTS 15 171 30515200
365931801 michael3437 E1 March 9, 2026, 2:28 a.m. OK PyPy 3-64 TESTS 16 171 33484800
365905589 HarshalN E1 March 8, 2026, 6:15 p.m. OK PyPy 3-64 TESTS 15 203 31334400
365891781 Mentholzzz E1 March 8, 2026, 4:36 p.m. OK PyPy 3-64 TESTS 15 218 27443200
365900333 CarViz E1 March 8, 2026, 5:25 p.m. OK PyPy 3-64 TESTS 15 218 27750400
365899594 Cenix820 E1 March 8, 2026, 5:21 p.m. OK PyPy 3-64 TESTS 15 218 28774400
365894057 titia E1 March 8, 2026, 4:49 p.m. OK PyPy 3-64 TESTS 15 218 28979200
365883753 Ibrohim_2014 E1 March 8, 2026, 3:55 p.m. OK Python 3 TESTS 15 781 49561600
365887992 hachiko2026 E1 March 8, 2026, 4:16 p.m. OK Ruby 3 TESTS 15 1343 52326400
365886650 Darknef E1 March 8, 2026, 4:09 p.m. OK Rust 2024 TESTS 15 78 18329600
365899750 SnowballSH E1 March 8, 2026, 5:22 p.m. OK Rust 2024 TESTS 15 93 21606400
365895306 DanielAnker E1 March 8, 2026, 4:56 p.m. OK Rust 2024 TESTS 15 109 18739200
365886942 Sugar_fan E1 March 8, 2026, 4:11 p.m. OK Rust 2024 TESTS 15 125 30720000

remove filters

Back to search problems