Codeforces Round 1095 (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
2226 Codeforces Round 1095 (Div. 2) FINISHED False 8100 1178664 April 28, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 2383 ) D Reserved Reversals PROGRAMMING constructive algorithms dp greedy

You are given an array (a) consisting of (n) positive integers. For any segment of the array starting at position (l) and ending at position (r) ((1 \le l \le r \le n)), let (m(l, r)) denote the minimum value in that segment, and (M(l, r)) denote the maximum value in that segment. Formally, () \begin{aligned} m(l,r) &= \min(a_l, a_{l+1}, \ldots, a_r),\\ M(l,r) &= \max(a_l, a_{l+1}, \ldots, a_r).\\ \end{aligned} () You may perform the following operation any number of times (possibly zero): Select two indices (l) and (r) ((1 \le l \le r \le n)) such that (m(l, r) + M(l, r)) is odd ; Reverse the entire segment (a_l, a_{l+1}, \ldots, a_r). In other words, for every (i) with (l \le i \le r), set (a_i := a_{l+r-i}) simultaneously. Determine whether you can make the array (a) non-decreasing (^{\text{∗}}) by performing a series of operations. (^{\text{∗}})An array (b_1, b_2, \ldots, b_k) is considered non-decreasing iff (b_1 \le b_2 \le \ldots \le b_k). 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 testcase contains a single integer (n) ((1 \le n \le 2\cdot10^5)) — the length of the array (a). The second line of each testcase contains (n) integers (a_1, a_2, \ldots, a_n) ((1 \le a_i \le n)) — the elements of the array. It is guaranteed that the sum of (n) over all test cases does not exceed (2\cdot10^5). For each test case, print " YES " if you can make the array (a) non-decreasing, and " NO " otherwise. 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. For the first testcase, the array is already non-decreasing. Hence, output YES. For the second testcase, let us choose (l = 1) and $$$

Tutorials

Codeforces Round 1095 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
372871453 sasafied D April 28, 2026, 4:46 p.m. OK C# 10 TESTS 30 78 716800
372859359 caffeine2ac D April 28, 2026, 4:03 p.m. OK C# 13 TESTS 30 78 15462400
372905548 aYi_7 D April 29, 2026, 3:35 a.m. OK C++17 (GCC 7-32) TESTS 30 62 102400
372869633 0xKurian D April 28, 2026, 4:39 p.m. OK C++17 (GCC 7-32) TESTS 30 62 102400
372901638 new2ac D April 29, 2026, 1:52 a.m. OK C++17 (GCC 7-32) TESTS 30 78 0
372884423 paxaq D April 28, 2026, 6:56 p.m. OK C++17 (GCC 7-32) TESTS 30 78 0
372871064 Pratyush0511 D April 28, 2026, 4:44 p.m. OK C++17 (GCC 7-32) TESTS 30 78 0
372870906 sabino1 D April 28, 2026, 4:44 p.m. OK C++17 (GCC 7-32) TESTS 30 78 0
372866723 aparesy56 D April 28, 2026, 4:28 p.m. OK C++17 (GCC 7-32) TESTS 30 78 0
372865377 black_01 D April 28, 2026, 4:23 p.m. OK C++17 (GCC 7-32) TESTS 30 78 0
372862051 samviteuler D April 28, 2026, 4:12 p.m. OK C++17 (GCC 7-32) TESTS 30 78 0
372860223 silnotalone D April 28, 2026, 4:06 p.m. OK C++17 (GCC 7-32) TESTS 30 78 0
372911103 Spasmodic D April 29, 2026, 5:32 a.m. OK C++20 (GCC 13-64) TESTS 30 62 0
372906327 vio_vv D April 29, 2026, 3:54 a.m. OK C++20 (GCC 13-64) TESTS 30 62 0
372896167 christopherbitti9 D April 28, 2026, 10:33 p.m. OK C++20 (GCC 13-64) TESTS 30 62 0
372907982 TienLee D April 29, 2026, 4:34 a.m. OK C++20 (GCC 13-64) TESTS 30 62 102400
372907209 TienLee D April 29, 2026, 4:16 a.m. OK C++20 (GCC 13-64) TESTS 30 62 102400
372903381 MikaMisono D April 29, 2026, 2:43 a.m. OK C++20 (GCC 13-64) TESTS 30 62 102400
372900201 jerry14285714 D April 29, 2026, 1:09 a.m. OK C++20 (GCC 13-64) TESTS 30 62 102400
372897784 notnot D April 28, 2026, 11:33 p.m. OK C++20 (GCC 13-64) TESTS 30 62 102400
372895753 Domzi1 D April 28, 2026, 10:19 p.m. OK C++20 (GCC 13-64) TESTS 30 62 102400
372889519 vozojk D April 28, 2026, 7:59 p.m. OK C++20 (GCC 13-64) TESTS 30 62 102400
372886967 424479543 D April 28, 2026, 7:26 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 46 102400
372899987 yueyuanzhiyyz D April 29, 2026, 1:01 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 46 307200
372869243 maspy D April 28, 2026, 4:37 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 46 409600
372913098 Isct D April 29, 2026, 6:03 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 62 0
372911143 Kendieer D April 29, 2026, 5:33 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 62 0
372906982 newbie367 D April 29, 2026, 4:10 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 62 0
372905146 Sam1019 D April 29, 2026, 3:26 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 62 0
372903471 DanRan02 D April 29, 2026, 2:45 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 62 0
372896547 Eduardmm D April 28, 2026, 10:46 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 62 0
372888476 CatalanConvolution D April 28, 2026, 7:44 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 62 0
372861920 bachthaison910 D April 28, 2026, 4:11 p.m. OK GNU C11 TESTS 30 78 716800
372886139 Banwait D April 28, 2026, 7:17 p.m. OK GNU C11 TESTS 30 78 819200
372865969 loveax D April 28, 2026, 4:25 p.m. OK GNU C11 TESTS 30 78 921600
372867961 Yash_jain01 D April 28, 2026, 4:32 p.m. OK Go TESTS 30 125 8089600
372872043 lucky33 D April 28, 2026, 4:48 p.m. OK Go TESTS 30 500 5222400
372860145 kartikjaju5 D April 28, 2026, 4:05 p.m. OK Java 21 TESTS 30 234 1228800
372860804 Power_Rangers_ D April 28, 2026, 4:07 p.m. OK Java 21 TESTS 30 250 819200
372892390 man-ray D April 28, 2026, 8:49 p.m. OK Java 21 TESTS 30 265 512000
372871683 chozenn D April 28, 2026, 4:46 p.m. OK Java 21 TESTS 30 265 1024000
372872163 InvariantCut D April 28, 2026, 4:48 p.m. OK Java 21 TESTS 30 281 716800
372864713 Prakrit18 D April 28, 2026, 4:21 p.m. OK Java 21 TESTS 30 281 1843200
372859172 tobiiiii D April 28, 2026, 4:02 p.m. OK Java 21 TESTS 30 281 5836800
372867457 yadavrajakran854 D April 28, 2026, 4:30 p.m. OK Java 21 TESTS 30 296 512000
372895278 hg_2005 D April 28, 2026, 10:04 p.m. OK Java 21 TESTS 30 296 1228800
372869409 tusaryan D April 28, 2026, 4:38 p.m. OK Java 21 TESTS 30 296 1843200
372866438 tohoshinki254 D April 28, 2026, 4:27 p.m. OK Java 8 TESTS 30 187 2662400
372865897 bitplease_ D April 28, 2026, 4:25 p.m. OK Node.js TESTS 30 156 31744000
372869583 M_N_Tushar D April 28, 2026, 4:39 p.m. OK Node.js TESTS 30 156 35225600
372872641 Hugo1729 D April 28, 2026, 4:49 p.m. OK PyPy 3 TESTS 30 421 16076800
372859259 outBoxer005 D April 28, 2026, 4:02 p.m. OK PyPy 3 TESTS 30 453 15667200
372855144 anikasomaia D April 28, 2026, 3:49 p.m. OK PyPy 3-64 TESTS 30 125 28774400
372870498 ItsNikolor D April 28, 2026, 4:42 p.m. OK PyPy 3-64 TESTS 30 156 17305600
372870818 Doflaming0 D April 28, 2026, 4:43 p.m. OK PyPy 3-64 TESTS 30 156 18329600
372857733 ecubic D April 28, 2026, 3:57 p.m. OK PyPy 3-64 TESTS 30 156 28774400
372871101 ai4youej D April 28, 2026, 4:44 p.m. OK PyPy 3-64 TESTS 30 171 20070400
372861120 pizet D April 28, 2026, 4:08 p.m. OK PyPy 3-64 TESTS 30 171 25804800
372866154 hxu10 D April 28, 2026, 4:26 p.m. OK PyPy 3-64 TESTS 30 171 27136000
372901801 explainer D April 29, 2026, 1:57 a.m. OK PyPy 3-64 TESTS 30 171 27443200
372898073 explainer D April 28, 2026, 11:45 p.m. OK PyPy 3-64 TESTS 30 171 28774400
372856858 GarvitGaur D April 28, 2026, 3:54 p.m. OK PyPy 3-64 TESTS 30 187 25190400
372868208 harsha_jagu D April 28, 2026, 4:33 p.m. OK Python 3 TESTS 30 140 23244800
372866618 SyntaxGambit D April 28, 2026, 4:27 p.m. OK Python 3 TESTS 30 156 21401600
372863390 PV3010 D April 28, 2026, 4:16 p.m. OK Python 3 TESTS 30 156 22323200
372870197 theSkynet D April 28, 2026, 4:41 p.m. OK Python 3 TESTS 30 156 23347200
372864799 shafinn D April 28, 2026, 4:21 p.m. OK Python 3 TESTS 30 156 24678400
372867643 yurkinmaxim73 D April 28, 2026, 4:31 p.m. OK Python 3 TESTS 30 187 24268800
372864264 surgicalbyte D April 28, 2026, 4:19 p.m. OK Python 3 TESTS 30 203 22016000
372869366 Muqeem D April 28, 2026, 4:38 p.m. OK Python 3 TESTS 30 203 24780800
372863430 palodkrish D April 28, 2026, 4:16 p.m. OK Python 3 TESTS 30 265 29184000
372858840 gastymor D April 28, 2026, 4:01 p.m. OK Python 3 TESTS 30 312 22732800
372863982 trycatchcry D April 28, 2026, 4:18 p.m. OK Rust 2024 TESTS 30 46 12492800
372858068 cvs-650 D April 28, 2026, 3:58 p.m. OK Rust 2024 TESTS 30 46 14643200
372858819 kushagrakaneki D April 28, 2026, 4:01 p.m. OK Rust 2024 TESTS 30 78 11776000

remove filters

Back to search problems