Codeforces Round 1019 (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
2103 Codeforces Round 1019 (Div. 2) FINISHED False 7200 31159523 April 21, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 3960 ) D Local Construction PROGRAMMING constructive algorithms dfs and similar graphs implementation two pointers

An element (b_i) ((1\le i\le m)) in an array (b_1, b_2, \ldots, b_m) is a local minimum if at least one of the following holds: (2\le i\le m - 1) and (b_i < b_{i - 1}) and (b_i < b_{i + 1}), or (i = 1) and (b_1 < b_2), or (i = m) and (b_m < b_{m - 1}). Similarly, an element (b_i) ((1\le i\le m)) in an array (b_1, b_2, \ldots, b_m) is a local maximum if at least one of the following holds: (2\le i\le m - 1) and (b_i > b_{i - 1}) and (b_i > b_{i + 1}), or (i = 1) and (b_1 > b_2), or (i = m) and (b_m > b_{m - 1}). Note that local minima and maxima are not defined for arrays with only one element. There is a hidden permutation(^{\text{∗}}) (p) of length (n). The following two operations are applied to permutation (p) alternately, starting from operation 1, until there is only one element left in (p): Operation 1 — remove all elements of (p) which are not local minima. Operation 2 — remove all elements of (p) which are not local maxima. More specifically, operation 1 is applied during every odd iteration, and operation 2 is applied during every even iteration, until there is only one element left in (p). For each index (i) ((1\le i\le n)), let (a_i) be the iteration number that element (p_i) is removed, or (-1) if it was never removed. It can be proven that there will be only one element left in (p) after at most (\lceil \log_2 n\rceil) iterations (in other words, (a_i \le \lceil \log_2 n\rceil)). You are given the array (a_1, a_2, \ldots, a_n). Your task is to construct any permutation (p) of (n) elements that satisfies array (a). (^{\text{∗}})A permutation of length (n) is an array consisting of (n) distinct integers from (1) to (n) in arbitrary order. For example, (2,3,1,5,4) is a permutation, but (1,2,2) is not a permutation ((2) appears twice in the array), and $$

Tutorials

142149

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
316638679 og.kostya D April 22, 2025, 5:55 a.m. OK C# 10 TESTS 19 124 6451200
316590370 stupidnessplusplus D April 21, 2025, 4:32 p.m. OK C# 10 TESTS 19 140 30105600
316627215 yzljy D April 22, 2025, 2:57 a.m. OK C++17 (GCC 7-32) TESTS 19 77 10035200
316605077 Hasanv D April 21, 2025, 6:27 p.m. OK C++17 (GCC 7-32) TESTS 19 93 0
316603947 pkhaustov D April 21, 2025, 6:18 p.m. OK C++17 (GCC 7-32) TESTS 19 93 102400
316624492 koishi123 D April 22, 2025, 2:08 a.m. OK C++17 (GCC 7-32) TESTS 19 93 1638400
316612900 Pankaj_Maurya D April 21, 2025, 7:44 p.m. OK C++17 (GCC 7-32) TESTS 19 93 2150400
316608323 rojagtap D April 21, 2025, 6:58 p.m. OK C++17 (GCC 7-32) TESTS 19 108 0
316596909 Md_Atik D April 21, 2025, 5:25 p.m. OK C++17 (GCC 7-32) TESTS 19 108 0
316589319 Dr.Bot D April 21, 2025, 4:30 p.m. OK C++17 (GCC 7-32) TESTS 19 108 0
316621195 11490DX D April 22, 2025, 12:53 a.m. OK C++17 (GCC 7-32) TESTS 19 108 1638400
316596188 Firefrog418 D April 21, 2025, 5:20 p.m. OK C++17 (GCC 7-32) TESTS 19 108 1638400
316621028 Jorgitox D April 22, 2025, 12:48 a.m. OK C++20 (GCC 13-64) TESTS 19 77 102400
316580826 Dell_Know D April 21, 2025, 4:09 p.m. OK C++20 (GCC 13-64) TESTS 19 78 0
316595429 AnasMaged D April 21, 2025, 5:16 p.m. OK C++20 (GCC 13-64) TESTS 19 78 102400
316633075 Fantasy_Blue D April 22, 2025, 4:35 a.m. OK C++20 (GCC 13-64) TESTS 19 78 307200
316626831 cwxzh D April 22, 2025, 2:51 a.m. OK C++20 (GCC 13-64) TESTS 19 78 2457600
316612208 yj1212 D April 21, 2025, 7:37 p.m. OK C++20 (GCC 13-64) TESTS 19 78 4096000
316633390 Young_Cloud D April 22, 2025, 4:40 a.m. OK C++20 (GCC 13-64) TESTS 19 92 0
316623279 gopalkalawate D April 22, 2025, 1:42 a.m. OK C++20 (GCC 13-64) TESTS 19 92 0
316581875 Hojstyer D April 21, 2025, 4:12 p.m. OK C++20 (GCC 13-64) TESTS 19 92 0
316637862 ChengyunSun D April 22, 2025, 5:44 a.m. OK C++20 (GCC 13-64) TESTS 19 92 3276800
316609266 sanbi52 D April 21, 2025, 7:08 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 77 0
316596929 star354 D April 21, 2025, 5:25 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 77 19763200
316623185 KeveinDurant D April 22, 2025, 1:40 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 78 0
316621457 cmy666 D April 22, 2025, 12:59 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 78 102400
316591450 424479543 D April 21, 2025, 4:34 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 78 819200
316639431 Suzuranovo D April 22, 2025, 6:05 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 93 0
316638379 Mosken D April 22, 2025, 5:51 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 93 0
316636378 jackylova_fan_fan_fan D April 22, 2025, 5:23 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 93 0
316628046 kokoLLLLL D April 22, 2025, 3:12 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 93 0
316626688 9756 D April 22, 2025, 2:48 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 93 0
316589928 1435730 D April 21, 2025, 4:31 p.m. OK GNU C11 TESTS 19 124 1638400
316634912 ahmedafeef D April 22, 2025, 5:02 a.m. OK GNU C11 TESTS 19 874 1638400
316591319 ok12 D April 21, 2025, 4:34 p.m. OK GNU C11 TESTS 19 889 4915200
316582256 cyclop5 D April 21, 2025, 4:13 p.m. OK Go TESTS 19 155 22425600
316596050 METASEKOIA D April 21, 2025, 5:19 p.m. OK Go TESTS 19 171 4608000
316582086 akshatsaxena552004.ss D April 21, 2025, 4:12 p.m. OK Java 21 TESTS 19 358 1024000
316619157 sahasrad D April 21, 2025, 11:53 p.m. OK Java 21 TESTS 19 421 4505600
316580732 priscillakirk D April 21, 2025, 4:09 p.m. OK Java 21 TESTS 19 546 18329600
316583983 baratrumvzone D April 21, 2025, 4:17 p.m. OK Java 21 TESTS 19 624 1638400
316582352 alicelowery D April 21, 2025, 4:13 p.m. OK Java 21 TESTS 19 702 22630400
316582914 emilymeyer D April 21, 2025, 4:14 p.m. OK Java 21 TESTS 19 749 19353600
316582483 sharonanderson D April 21, 2025, 4:13 p.m. OK Java 21 TESTS 19 749 19353600
316600184 ironman263 D April 21, 2025, 5:49 p.m. OK Java 21 TESTS 19 937 6656000
316581186 catherinecarson D April 21, 2025, 4:10 p.m. OK Java 21 TESTS 19 983 16793600
316608476 godAngryOver D April 21, 2025, 7 p.m. OK Java 8 TESTS 19 203 0
316591317 1091857051 D April 21, 2025, 4:34 p.m. OK Java 8 TESTS 19 218 1536000
316621414 kartik__sethi D April 22, 2025, 12:58 a.m. OK Java 8 TESTS 19 327 14745600
316629206 Dduo D April 22, 2025, 3:32 a.m. OK Java 8 TESTS 19 484 1843200
316586700 Kira_Dev D April 21, 2025, 4:23 p.m. OK Kotlin 1.7 TESTS 19 1265 154624000
316620862 jagbarrameda D April 22, 2025, 12:44 a.m. OK Kotlin 1.9 TESTS 19 358 10035200
316609193 ManasJain D April 21, 2025, 7:07 p.m. OK PyPy 3 TESTS 19 343 17920000
316625949 Emperor_Chen_Bai D April 22, 2025, 2:36 a.m. OK PyPy 3-64 TESTS 19 186 26214400
316619959 smilences D April 22, 2025, 12:18 a.m. OK PyPy 3-64 TESTS 19 218 24064000
316584332 ssstormmid D April 21, 2025, 4:18 p.m. OK PyPy 3-64 TESTS 19 218 29081600
316585127 sushmanth.dampur8780 D April 21, 2025, 4:19 p.m. OK PyPy 3-64 TESTS 19 233 22630400
316596538 feminist16 D April 21, 2025, 5:22 p.m. OK PyPy 3-64 TESTS 19 233 34201600
316638079 LightHouse1 D April 22, 2025, 5:47 a.m. OK PyPy 3-64 TESTS 19 234 23347200
316602565 DarkTemplarDrop D April 21, 2025, 6:07 p.m. OK PyPy 3-64 TESTS 19 249 27648000
316627985 rank007 D April 22, 2025, 3:11 a.m. OK PyPy 3-64 TESTS 19 249 33587200
316591367 FZANOTFOUND D April 21, 2025, 4:34 p.m. OK PyPy 3-64 TESTS 19 264 25497600
316596558 DarkTemplarDrop D April 21, 2025, 5:22 p.m. OK PyPy 3-64 TESTS 19 265 31539200
316586952 sahilmit D April 21, 2025, 4:24 p.m. OK Python 3 TESTS 19 655 37478400
316588950 just_ps9 D April 21, 2025, 4:29 p.m. OK Python 3 TESTS 19 671 39116800
316583772 pandeySAN D April 21, 2025, 4:16 p.m. OK Python 3 TESTS 19 1015 38502400
316589424 igor99972 D April 21, 2025, 4:30 p.m. OK Python 3 TESTS 19 1608 56729600
316584816 CathySilverman D April 21, 2025, 4:19 p.m. OK Rust 2021 TESTS 19 108 9523200
316584252 vadimka123ggg D April 21, 2025, 4:17 p.m. OK Rust 2021 TESTS 19 125 7987200
316580917 Newstart27 D April 21, 2025, 4:09 p.m. OK Rust 2021 TESTS 19 125 8396800
316581823 dexter123666 D April 21, 2025, 4:11 p.m. OK Rust 2021 TESTS 19 140 7168000
316582858 dizzzy D April 21, 2025, 4:14 p.m. OK Rust 2021 TESTS 19 140 10547200
316588825 DeanMenezes93 D April 21, 2025, 4:29 p.m. OK Rust 2021 TESTS 19 140 15052800
316583162 mynameisxander D April 21, 2025, 4:15 p.m. OK Rust 2021 TESTS 19 156 9011200
316584530 21312312ttt D April 21, 2025, 4:18 p.m. OK Rust 2021 TESTS 19 171 14336000

remove filters

Back to search problems