Codeforces Round 1029 (Div. 3)

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
2117 Codeforces Round 1029 (Div. 3) FINISHED False 8100 27098684 June 8, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 32053 ) B Shrink PROGRAMMING constructive algorithms

A shrink operation on an array (a) of size (m) is defined as follows: Choose an index (i) ((2 \le i \le m - 1)) such that (a_i \gt a_{i - 1}) and (a_i \gt a_{i + 1}). Remove (a_i) from the array. Define the score of a permutation(^{\text{∗}}) (p) as the maximum number of times that you can perform the shrink operation on (p). Yousef has given you a single integer (n). Construct a permutation (p) of length (n) with the maximum possible score . If there are multiple answers, you can output any of them. (^{\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 (1,3,4) is also not a permutation ((n=3) but there is (4) in the array). The first line of the input contains an integer (t) ((1 \le t \le 10^3)) — the number of test cases. Each test case contains an integer (n) ((3 \le n \le 2 \cdot 10^5)) — the size of the permutation. It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, output any permutation (p_1, p_2, \dots, p_n) that maximizes the number of shrink operations. In the first test case: We choose (p = 1, 3, 2). Choose index (2), and remove (p_2) from the array. The array becomes (p = 1, 2). It can be shown that the maximum number of operations we can perform is (1). Another valid answer is (p = 2, 3, 1). In the second test case: We choose (p = 2, 3, 6, 4, 5, 1). Choose index (5), and remove (p_5) from the array. The array becomes (p = 2, 3, 6, 4, 1). Choose index (3), and remove (p_3) from the array. The array becomes (p = 2, 3, 4, 1). Choose index (3), and remove (p_3) from the array. The array becomes $$$p = 2, 3, 1

Tutorials

Codeforces Round 1029 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
323662633 Ouyia B June 9, 2025, 4:20 p.m. OK C# 10 TESTS 4 108 20275200
323662831 Ouyia B June 9, 2025, 4:21 p.m. OK C# 10 TESTS 4 140 20275200
323713506 og.kostya B June 10, 2025, 5:13 a.m. OK C# 13 TESTS 4 92 3174400
323709193 Kamalesh_bala B June 10, 2025, 4:18 a.m. OK C++17 (GCC 7-32) TESTS 4 46 0
323708684 real_Parallelism B June 10, 2025, 4:11 a.m. OK C++17 (GCC 7-32) TESTS 4 46 0
323687449 odairclamel B June 9, 2025, 8:18 p.m. OK C++17 (GCC 7-32) TESTS 4 46 0
323685721 Manoraa B June 9, 2025, 7:53 p.m. OK C++17 (GCC 7-32) TESTS 4 46 0
323680564 Harsh_2O26 B June 9, 2025, 6:49 p.m. OK C++17 (GCC 7-32) TESTS 4 46 0
323680303 S_muni B June 9, 2025, 6:46 p.m. OK C++17 (GCC 7-32) TESTS 4 46 0
323655430 Cric_83 B June 9, 2025, 3:21 p.m. OK C++17 (GCC 7-32) TESTS 4 46 0
323654804 ahmedismail612 B June 9, 2025, 3:16 p.m. OK C++17 (GCC 7-32) TESTS 4 46 0
323650852 kumarnavneet B June 9, 2025, 2:45 p.m. OK C++17 (GCC 7-32) TESTS 4 46 0
323637726 _AhmedTarek_ B June 9, 2025, 1:08 p.m. OK C++17 (GCC 7-32) TESTS 4 46 0
323608035 Kamikazee112 B June 9, 2025, 9:29 a.m. OK C++20 (GCC 13-64) TESTS 4 31 0
323710942 gigga_dummy B June 10, 2025, 4:42 a.m. OK C++20 (GCC 13-64) TESTS 4 46 0
323709244 sagor_barua B June 10, 2025, 4:18 a.m. OK C++20 (GCC 13-64) TESTS 4 46 0
323709240 WAcrazier B June 10, 2025, 4:18 a.m. OK C++20 (GCC 13-64) TESTS 4 46 0
323707466 Amadeus027 B June 10, 2025, 3:54 a.m. OK C++20 (GCC 13-64) TESTS 4 46 0
323707212 thepratholic B June 10, 2025, 3:51 a.m. OK C++20 (GCC 13-64) TESTS 4 46 0
323706548 atickisrak B June 10, 2025, 3:41 a.m. OK C++20 (GCC 13-64) TESTS 4 46 0
323706509 _pussyCat B June 10, 2025, 3:40 a.m. OK C++20 (GCC 13-64) TESTS 4 46 0
323701882 RUOHUI B June 10, 2025, 2:22 a.m. OK C++20 (GCC 13-64) TESTS 4 46 0
323700851 abncdf B June 10, 2025, 1:59 a.m. OK C++20 (GCC 13-64) TESTS 4 46 0
323711947 varun2107 B June 10, 2025, 4:56 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 31 0
323628454 ritik2005 B June 9, 2025, 12:02 p.m. OK C++23 (GCC 14-64, msys2) TESTS 4 31 0
323617048 dermale B June 9, 2025, 10:33 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 31 0
323718182 bandiaoz B June 10, 2025, 6:06 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 46 0
323716119 rayxon_33 B June 10, 2025, 5:42 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 46 0
323714106 yxfql B June 10, 2025, 5:20 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 46 0
323711193 BlackMamba B June 10, 2025, 4:46 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 46 0
323710237 Anuj123321 B June 10, 2025, 4:32 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 46 0
323709617 Stalin67 B June 10, 2025, 4:23 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 46 0
323709510 Phdoofus14 B June 10, 2025, 4:22 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 46 0
323653203 rayahazari B June 9, 2025, 3:03 p.m. OK GNU C11 TESTS 4 811 102400
323652794 fadeevich B June 9, 2025, 3 p.m. OK GNU C11 TESTS 4 827 102400
323632457 korch B June 9, 2025, 12:31 p.m. OK GNU C11 TESTS 4 827 102400
323620662 dhruvbansal186 B June 9, 2025, 11:02 a.m. OK GNU C11 TESTS 4 843 0
323659593 Sanchayan_Sengupta B June 9, 2025, 3:55 p.m. OK GNU C11 TESTS 4 858 102400
323629230 eatyumi B June 9, 2025, 12:08 p.m. OK GNU C11 TESTS 4 858 102400
323662509 Lucifer1729 B June 9, 2025, 4:19 p.m. OK Go TESTS 4 250 3174400
323707810 tahsin_ferdous B June 10, 2025, 3:59 a.m. OK Go TESTS 4 265 1638400
323612479 Cyborg2510 B June 9, 2025, 10:01 a.m. OK Go TESTS 4 280 1638400
323617914 jindal2004keshav B June 9, 2025, 10:40 a.m. OK Java 21 TESTS 4 234 0
323612766 Mostafa_Murad B June 9, 2025, 10:03 a.m. OK Java 21 TESTS 4 249 0
323672593 snehakanodia4 B June 9, 2025, 5:39 p.m. OK Java 21 TESTS 4 249 41881600
323656419 winkhatri292004 B June 9, 2025, 3:29 p.m. OK Java 21 TESTS 4 265 2048000
323679811 dineshdcoc B June 9, 2025, 6:41 p.m. OK Java 21 TESTS 4 280 512000
323713243 Q_R_Y B June 10, 2025, 5:10 a.m. OK Java 21 TESTS 4 281 307200
323583040 sriram_18 B June 9, 2025, 5:49 a.m. OK Java 21 TESTS 4 281 614400
323655099 parni6ka0 B June 9, 2025, 3:18 p.m. OK Java 21 TESTS 4 296 307200
323608578 Ronit0211 B June 9, 2025, 9:33 a.m. OK Java 21 TESTS 4 296 307200
323652647 WrongAnswerOnTestCase2 B June 9, 2025, 2:59 p.m. OK Java 21 TESTS 4 296 1433600
323668674 Hi_tanishq B June 9, 2025, 5:06 p.m. OK Java 8 TESTS 4 406 0
323670939 _neeraj__ B June 9, 2025, 5:25 p.m. OK Java 8 TESTS 4 421 0
323628921 sunil_singh B June 9, 2025, 12:06 p.m. OK Java 8 TESTS 4 421 0
323614606 priyanshu3003 B June 9, 2025, 10:15 a.m. OK Java 8 TESTS 4 421 0
323688675 Sumitsingh7 B June 9, 2025, 8:38 p.m. OK Java 8 TESTS 4 421 8192000
323683652 satyams_9001 B June 9, 2025, 7:25 p.m. OK Java 8 TESTS 4 421 8192000
323710283 sanikadesh B June 10, 2025, 4:33 a.m. OK Java 8 TESTS 4 437 0
323618383 arpit_ehh B June 9, 2025, 10:44 a.m. OK Java 8 TESTS 4 437 0
323617457 manitejapattem B June 9, 2025, 10:37 a.m. OK Java 8 TESTS 4 437 0
323641576 darkshadow03 B June 9, 2025, 1:36 p.m. OK Java 8 TESTS 4 452 102400
323705159 Muhammad-Saram B June 10, 2025, 3:20 a.m. OK Kotlin 1.7 TESTS 4 593 9932800
323635257 swseverance B June 9, 2025, 12:52 p.m. OK Node.js TESTS 4 155 35942400
323683570 unknow754389 B June 9, 2025, 7:24 p.m. OK PyPy 3 TESTS 4 233 11776000
323717754 Dias1177 B June 10, 2025, 6:01 a.m. OK PyPy 3 TESTS 4 265 10752000
323693503 adem1234 B June 9, 2025, 10:29 p.m. OK PyPy 3 TESTS 4 281 8908800
323686595 upior B June 9, 2025, 8:05 p.m. OK PyPy 3 TESTS 4 296 9113600
323639888 LiaoShengyu B June 9, 2025, 1:24 p.m. OK PyPy 3-64 TESTS 4 93 6963200
323656403 sap05 B June 9, 2025, 3:29 p.m. OK PyPy 3-64 TESTS 4 93 7884800
323666415 Ne0B1ade B June 9, 2025, 4:48 p.m. OK PyPy 3-64 TESTS 4 93 8089600
323642339 diptansuroy B June 9, 2025, 1:42 p.m. OK PyPy 3-64 TESTS 4 93 16281600
323702853 Beaten B June 10, 2025, 2:40 a.m. OK PyPy 3-64 TESTS 4 108 4710400
323632248 theohcuber B June 9, 2025, 12:29 p.m. OK PyPy 3-64 TESTS 4 108 4710400
323620694 PythonicVarun B June 9, 2025, 11:02 a.m. OK PyPy 3-64 TESTS 4 108 4812800
323684238 catgirl B June 9, 2025, 7:32 p.m. OK PyPy 3-64 TESTS 4 108 5017600
323608189 Manish_Jangir B June 9, 2025, 9:30 a.m. OK PyPy 3-64 TESTS 4 108 7577600
323618944 Loki_28 B June 9, 2025, 10:49 a.m. OK PyPy 3-64 TESTS 4 108 7782400
323650685 urjatendolkar B June 9, 2025, 2:44 p.m. OK Python 3 TESTS 4 108 15872000
323717663 jihan23arora26 B June 10, 2025, 6 a.m. OK Python 3 TESTS 4 109 15462400
323581841 anejmeldeen B June 9, 2025, 5:38 a.m. OK Python 3 TESTS 4 109 20889600
323691940 heisenberg06 B June 9, 2025, 9:45 p.m. OK Python 3 TESTS 4 109 23347200
323658463 mihilsree B June 9, 2025, 3:46 p.m. OK Python 3 TESTS 4 109 23654400
323611857 scorpion B June 9, 2025, 9:57 a.m. OK Python 3 TESTS 4 124 14336000
323716340 kaluginpeter B June 10, 2025, 5:45 a.m. OK Python 3 TESTS 4 125 21811200
323700562 pundruvarshith17 B June 10, 2025, 1:53 a.m. OK Python 3 TESTS 4 125 23347200
323699123 Cipher_In_ B June 10, 2025, 1:31 a.m. OK Python 3 TESTS 4 218 9932800
323675796 Jithu_Morrison B June 9, 2025, 6:06 p.m. OK Python 3 TESTS 4 218 9932800
323693828 Xeramian B June 9, 2025, 10:38 p.m. OK Rust 2021 TESTS 4 61 102400
323632458 cinkozzz B June 9, 2025, 12:31 p.m. OK Rust 2021 TESTS 4 77 0
323699769 acitrus B June 10, 2025, 1:42 a.m. OK Rust 2021 TESTS 4 77 8089600
323615707 acitrus B June 9, 2025, 10:22 a.m. OK Rust 2021 TESTS 4 77 8192000

remove filters

Back to search problems