Nebius Round 2 (Codeforces Round 1088, 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
2211 Nebius Round 2 (Codeforces Round 1088, Div. 1 + Div. 2) FINISHED False 9000 1696523 March 28, 2026, 2:45 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 79 ) H Median Deletion PROGRAMMING

You are given a permutation (p) of size (n). You may perform the following operation any number of times: Choose a subarray of size (3). Then, delete the second smallest element within it. For example, for the permutation (2,4,5,3,1), you may choose the subarray (\mathbf{2},\mathbf{4},\mathbf{5},3,1). Since (4) is the second smallest element out of (2,4,5), you can delete (4) to obtain the array (2,5,3,1). For each (i) from (1) to (n), find the minimum length of an obtainable array that contains the number (p_i). Note that this problem is to be solved independently for each (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 \le n \le 2 \cdot 10^5)) — the length of the permutation. The second line of each test case contains (n) integers (p_1, p_2, \ldots, p_n) ((1 \le p_i \le n)). It is guaranteed that the given (p) is a 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 (n) numbers on a new line: the answer for (i=1,2,\ldots,n). In the second example, for (i=1), we can get an array of size (2) as follows: Choose the subarray (4,2,1). Delete the median (2). The array is now (4,1,3). Choose the subarray (4,1,3). Delete the median (3). The array is now (4,1). It can be shown that (2) is the minimum length of any reachable array that contains (a_1=4). For (i=4), the answer is (3), with the minimum length reachable array containing (a_4=3) being (4,1,3).

Tutorials

Nebius Round 2 and Codeforces Round 1088 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
368611972 sparshgaur H March 28, 2026, 9:25 p.m. OK C++17 (GCC 7-32) TESTS 22 125 25702400
368604780 NestorVilcapoma_ H March 28, 2026, 7:23 p.m. OK C++17 (GCC 7-32) TESTS 22 140 33177600
368611318 -is-this-dft- H March 28, 2026, 9:11 p.m. OK C++17 (GCC 7-32) TESTS 22 187 69017600
368622634 NestorVilcapoma_ H March 29, 2026, 2:57 a.m. OK C++17 (GCC 7-32) TESTS 22 421 46387200
368622958 wwqq88 H March 29, 2026, 3:05 a.m. OK C++17 (GCC 7-32) TESTS 22 453 1945600
368589447 tourist H March 28, 2026, 4:56 p.m. OK C++20 (GCC 13-64) TESTS 22 109 25497600
368625073 benben181 H March 29, 2026, 3:48 a.m. OK C++20 (GCC 13-64) TESTS 22 390 1945600
368615900 hungchi17 H March 28, 2026, 11:20 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 125 27750400
368615783 Kevin114514 H March 28, 2026, 11:16 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 140 12083200
368619713 Benq H March 29, 2026, 1:43 a.m. OK C++23 (GCC 14-64, msys2) TESTS 22 156 29491200
368595426 failedbun H March 28, 2026, 5:14 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 343 20480000
368601896 brownchocochip H March 28, 2026, 6:51 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 375 20480000
368601272 Golovanov399 H March 28, 2026, 6:46 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 406 1126400
368608039 clawson19 H March 28, 2026, 8:10 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 421 54272000
368603609 JohnNash01 H March 28, 2026, 7:10 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 500 54272000
368606431 wangxiaojingzi H March 28, 2026, 7:46 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 687 69529600
368586735 turmax H March 28, 2026, 4:48 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 1234 56627200
368611070 Thunder_13 H March 28, 2026, 9:05 p.m. OK PyPy 3-64 TESTS 22 781 122675200

remove filters

Back to search problems