Codeforces Round 987 (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
2031 Codeforces Round 987 (Div. 2) FINISHED False 7200 44817884 Nov. 15, 2024, 12:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 20894 ) A Penchick and Modern Monument PROGRAMMING dp greedy math two pointers

Amidst skyscrapers in the bustling metropolis of Metro Manila, the newest Noiph mall in the Philippines has just been completed! The construction manager, Penchick, ordered a state-of-the-art monument to be built with (n) pillars. The heights of the monument's pillars can be represented as an array (h) of (n) positive integers, where (h_i) represents the height of the (i)-th pillar for all (i) between (1) and (n). Penchick wants the heights of the pillars to be in non-decreasing order, i.e. (h_i \le h_{i + 1}) for all (i) between (1) and (n - 1). However, due to confusion, the monument was built such that the heights of the pillars are in non-increasing order instead, i.e. (h_i \ge h_{i + 1}) for all (i) between (1) and (n - 1). Luckily, Penchick can modify the monument and do the following operation on the pillars as many times as necessary: Modify the height of a pillar to any positive integer. Formally, choose an index (1\le i\le n) and a positive integer (x). Then, assign (h_i := x). Help Penchick determine the minimum number of operations needed to make the heights of the monument's pillars non-decreasing . Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 1000)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((1 \leq n \leq 50)) — the number of pillars. The second line of each test case contains (n) integers (h_1, h_2, \ldots, h_n) ((1 \le h_i \le n) and (h_i\ge h_{i+1})) — the height of the pillars. Please take note that the given array (h) is non-increasing. Note that there are no constraints on the sum of (n) over all test cases. For each test case, output a single integer representing the minimum number of operations needed to make the heights of the pillars non-decreasing . In the first test case, the initial heights

Tutorials

Codeforces Round 987 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
291714058 addabis A Nov. 15, 2024, 9:50 p.m. OK C# 10 TESTS 3 93 409600
291685341 sumon_ahmed A Nov. 15, 2024, 5:42 p.m. OK C++17 (GCC 7-32) TESTS 3 15 0
291740651 Mokshit_321 A Nov. 16, 2024, 5:22 a.m. OK C++17 (GCC 7-32) TESTS 3 30 0
291733408 MidhunNair A Nov. 16, 2024, 3:49 a.m. OK C++17 (GCC 7-32) TESTS 3 30 0
291724120 flandre.scarlet A Nov. 16, 2024, 1:24 a.m. OK C++17 (GCC 7-32) TESTS 3 30 0
291723687 FriedDoorMat A Nov. 16, 2024, 1:15 a.m. OK C++17 (GCC 7-32) TESTS 3 30 0
291711395 bkdn24.karuizawa A Nov. 15, 2024, 9:16 p.m. OK C++17 (GCC 7-32) TESTS 3 30 0
291698462 durga_7 A Nov. 15, 2024, 7:10 p.m. OK C++17 (GCC 7-32) TESTS 3 30 0
291689478 Always_A_Newbie01 A Nov. 15, 2024, 6:03 p.m. OK C++17 (GCC 7-32) TESTS 3 30 0
291683411 EgorKush A Nov. 15, 2024, 5:32 p.m. OK C++17 (GCC 7-32) TESTS 3 30 0
291742666 Jayant001 A Nov. 16, 2024, 5:42 a.m. OK C++17 (GCC 7-32) TESTS 3 30 0
291663047 francarthery A Nov. 15, 2024, 3:44 p.m. OK C++20 (GCC 13-64) TESTS 2 15 0
291664166 priyansh13 A Nov. 15, 2024, 3:49 p.m. OK C++20 (GCC 13-64) TESTS 2 15 102400
291674180 berlin_5911 A Nov. 15, 2024, 4:39 p.m. OK C++20 (GCC 13-64) TESTS 2 15 102400
291662798 chrono_prac A Nov. 15, 2024, 3:43 p.m. OK C++20 (GCC 13-64) TESTS 2 15 102400
291727278 RODAN19 A Nov. 16, 2024, 2:21 a.m. OK C++20 (GCC 13-64) TESTS 3 30 0
291737609 Dps_spD A Nov. 16, 2024, 4:47 a.m. OK C++20 (GCC 13-64) TESTS 3 30 0
291735989 Song4u A Nov. 16, 2024, 4:24 a.m. OK C++20 (GCC 13-64) TESTS 3 30 0
291729646 theChikyuu A Nov. 16, 2024, 2:57 a.m. OK C++20 (GCC 13-64) TESTS 3 30 0
291729061 qi-wanfeng A Nov. 16, 2024, 2:48 a.m. OK C++20 (GCC 13-64) TESTS 3 30 0
291725181 LouiseTheorinesion05 A Nov. 16, 2024, 1:43 a.m. OK C++20 (GCC 13-64) TESTS 3 30 0
291663618 baodat A Nov. 15, 2024, 3:46 p.m. OK C++23 (GCC 14-64, msys2) TESTS 2 15 0
291663281 ritamiitism A Nov. 15, 2024, 3:45 p.m. OK C++23 (GCC 14-64, msys2) TESTS 2 15 102400
291673220 Top12 A Nov. 15, 2024, 4:35 p.m. OK C++23 (GCC 14-64, msys2) TESTS 2 30 0
291735929 dermale A Nov. 16, 2024, 4:23 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 30 0
291731429 ehdxbc A Nov. 16, 2024, 3:22 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 30 0
291728059 Ngeces A Nov. 16, 2024, 2:34 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 30 0
291726755 tszj A Nov. 16, 2024, 2:12 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 30 0
291724610 ajey35 A Nov. 16, 2024, 1:33 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 30 0
291697532 AnImEsH_AnIi A Nov. 15, 2024, 7:04 p.m. OK C++23 (GCC 14-64, msys2) TESTS 3 30 0
291680103 hippo19 A Nov. 15, 2024, 5:09 p.m. OK C++23 (GCC 14-64, msys2) TESTS 3 30 0
291716930 bluemegane A Nov. 15, 2024, 10:35 p.m. OK C# 8 TESTS 3 124 1228800
291728851 Brackets12 A Nov. 16, 2024, 2:45 a.m. OK FPC TESTS 3 46 0
291695473 ratul49 A Nov. 15, 2024, 6:47 p.m. OK GNU C11 TESTS 3 15 0
291652497 kathanshah743 A Nov. 15, 2024, 2:25 p.m. OK GNU C11 TESTS 2 15 0
291701355 Prat_ghost3378 A Nov. 15, 2024, 7:33 p.m. OK GNU C11 TESTS 3 30 0
291684367 AbbasMehdi A Nov. 15, 2024, 5:37 p.m. OK GNU C11 TESTS 3 31 0
291671196 Readyone A Nov. 15, 2024, 4:26 p.m. OK GNU C11 TESTS 2 31 0
291725136 coding_pot A Nov. 16, 2024, 1:42 a.m. OK GNU C11 TESTS 3 31 102400
291666912 RESILIENT1 A Nov. 15, 2024, 4:03 p.m. OK GNU C11 TESTS 2 31 102400
291655425 hhhwwwhhh A Nov. 15, 2024, 2:32 p.m. OK GNU C11 TESTS 2 46 0
291738130 sleepntsheep A Nov. 16, 2024, 4:54 a.m. OK GNU C11 TESTS 3 46 102400
291680255 confluence_of_BandW A Nov. 15, 2024, 5:10 p.m. OK GNU C11 TESTS 3 61 0
291680269 fardinkamal62 A Nov. 15, 2024, 5:11 p.m. OK Go TESTS 3 46 409600
291667380 BurnerAce A Nov. 15, 2024, 4:05 p.m. OK Java 21 TESTS 2 187 0
291704270 krantikumar0503 A Nov. 15, 2024, 7:59 p.m. OK Java 21 TESTS 3 202 0
291664611 Sanat0412 A Nov. 15, 2024, 3:51 p.m. OK Java 21 TESTS 2 203 0
291740721 rupeshpatelcf A Nov. 16, 2024, 5:23 a.m. OK Java 21 TESTS 3 217 204800
291695931 akshatsaxena552004.ss A Nov. 15, 2024, 6:50 p.m. OK Java 21 TESTS 3 217 409600
291711800 Anas45 A Nov. 15, 2024, 9:21 p.m. OK Java 21 TESTS 3 217 1945600
291655309 Shandilya09 A Nov. 15, 2024, 2:31 p.m. OK Java 21 TESTS 2 218 0
291739914 SGupta31 A Nov. 16, 2024, 5:14 a.m. OK Java 21 TESTS 3 218 0
291719918 goalboy A Nov. 15, 2024, 11:58 p.m. OK Java 21 TESTS 3 218 716800
291668711 OmarKashour A Nov. 15, 2024, 4:13 p.m. OK Java 21 TESTS 2 218 921600
291677653 harsh_1806 A Nov. 15, 2024, 4:55 p.m. OK Java 8 TESTS 2 109 0
291719163 Sreven A Nov. 15, 2024, 11:35 p.m. OK Java 8 TESTS 3 124 0
291745489 lanby A Nov. 16, 2024, 6:07 a.m. OK Java 8 TESTS 3 139 0
291664248 pranavpatil9876 A Nov. 15, 2024, 3:49 p.m. OK Java 8 TESTS 2 139 0
291728455 Akanksha34 A Nov. 16, 2024, 2:40 a.m. OK Java 8 TESTS 3 171 0
291704247 ranjeet08 A Nov. 15, 2024, 7:59 p.m. OK Java 8 TESTS 3 171 0
291700313 Akshat_Gupta._ A Nov. 15, 2024, 7:25 p.m. OK Java 8 TESTS 3 171 0
291666889 mukundagarawal9 A Nov. 15, 2024, 4:03 p.m. OK Java 8 TESTS 2 171 0
291663399 Extraordnrly_MEDIOCRE A Nov. 15, 2024, 3:45 p.m. OK Java 8 TESTS 2 171 0
291733560 ivyan A Nov. 16, 2024, 3:51 a.m. OK Java 8 TESTS 3 186 0
291744025 parahadowmerdan237 A Nov. 16, 2024, 5:54 a.m. OK PascalABC.NET TESTS 3 203 1228800
291742272 rajeshpenugonda A Nov. 16, 2024, 5:38 a.m. OK PyPy 3 TESTS 3 139 3276800
291733138 sasukeji A Nov. 16, 2024, 3:45 a.m. OK PyPy 3 TESTS 3 155 5734400
291666015 VitalyKo A Nov. 15, 2024, 3:58 p.m. OK PyPy 3 TESTS 2 156 5222400
291663082 siddhantbakshi1979 A Nov. 15, 2024, 3:44 p.m. OK PyPy 3 TESTS 2 171 2662400
291720081 Ilyasdev A Nov. 16, 2024, 12:03 a.m. OK PyPy 3 TESTS 3 171 4608000
291681961 immrhrroff A Nov. 15, 2024, 5:22 p.m. OK PyPy 3 TESTS 3 186 5222400
291668794 BLACKDEX09 A Nov. 15, 2024, 4:13 p.m. OK PyPy 3 TESTS 2 202 5734400
291655426 Crackbrain07 A Nov. 15, 2024, 2:32 p.m. OK PyPy 3 TESTS 2 624 5632000
291699936 YhuanDebeste A Nov. 15, 2024, 7:22 p.m. OK PyPy 3-64 TESTS 3 62 1638400
291729739 Mattokodu A Nov. 16, 2024, 2:59 a.m. OK PyPy 3-64 TESTS 3 77 1843200
291662914 YhuanDebeste A Nov. 15, 2024, 3:43 p.m. OK PyPy 3-64 TESTS 2 92 1536000
291673371 gardengnome A Nov. 15, 2024, 4:35 p.m. OK PyPy 3-64 TESTS 2 92 1638400
291703986 porcelli A Nov. 15, 2024, 7:56 p.m. OK PyPy 3-64 TESTS 3 92 1945600
291669500 YhuanDebeste A Nov. 15, 2024, 4:17 p.m. OK PyPy 3-64 TESTS 2 93 2048000
291671776 szpu_ark A Nov. 15, 2024, 4:28 p.m. OK PyPy 3-64 TESTS 2 93 2150400
291666943 Abhiram_29 A Nov. 15, 2024, 4:03 p.m. OK PyPy 3-64 TESTS 2 93 2150400
291686900 MassimoG A Nov. 15, 2024, 5:50 p.m. OK PyPy 3-64 TESTS 3 93 2355200
291738539 iygav1238 A Nov. 16, 2024, 4:59 a.m. OK PyPy 3-64 TESTS 3 93 2867200
291663036 Saquif_Sohol A Nov. 15, 2024, 3:44 p.m. OK Python 3 TESTS 2 46 0
291653341 khatam_aadmi A Nov. 15, 2024, 2:27 p.m. OK Python 3 TESTS 2 46 0
291737656 tupdaily A Nov. 16, 2024, 4:48 a.m. OK Python 3 TESTS 3 61 0
291725912 bilal_hassan2011 A Nov. 16, 2024, 1:56 a.m. OK Python 3 TESTS 3 61 0
291725158 jai_gurudev A Nov. 16, 2024, 1:43 a.m. OK Python 3 TESTS 3 61 0
291721024 Md.Shorif_mia A Nov. 16, 2024, 12:31 a.m. OK Python 3 TESTS 3 61 0
291717898 sariba A Nov. 15, 2024, 10:58 p.m. OK Python 3 TESTS 3 61 0
291712850 DDarioo A Nov. 15, 2024, 9:34 p.m. OK Python 3 TESTS 3 61 0
291686056 pavankumar456 A Nov. 15, 2024, 5:46 p.m. OK Python 3 TESTS 3 61 0
291668373 pranavtej A Nov. 15, 2024, 4:11 p.m. OK Python 3 TESTS 2 61 0
291664196 YhuanDebeste A Nov. 15, 2024, 3:49 p.m. OK Ruby 3 TESTS 2 249 409600
291663968 YhuanDebeste A Nov. 15, 2024, 3:48 p.m. OK Ruby 3 TESTS 2 249 614400
291699030 YhuanDebeste A Nov. 15, 2024, 7:15 p.m. OK Ruby 3 TESTS 3 296 409600
291735703 a.dot A Nov. 16, 2024, 4:20 a.m. OK Rust 2021 TESTS 3 46 0
291724587 n0b0dy01 A Nov. 16, 2024, 1:32 a.m. OK Rust 2021 TESTS 3 46 0
291711667 FLC159 A Nov. 15, 2024, 9:19 p.m. OK Rust 2021 TESTS 3 46 0
291687514 Allergy527 A Nov. 15, 2024, 5:53 p.m. OK Rust 2021 TESTS 3 46 0
291665232 0x81 A Nov. 15, 2024, 3:54 p.m. OK Rust 2021 TESTS 2 46 0
291664474 Hyrulia A Nov. 15, 2024, 3:50 p.m. OK Rust 2021 TESTS 2 46 0

remove filters

Back to search problems