Codeforces Round 772 (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
1635 Codeforces Round 772 (Div. 2) FINISHED False 7200 86455499 Feb. 20, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 17956 ) B Avoid Local Maximums PROGRAMMING greedy

B"You are given an array a of size n . Each element in this array is an integer between 1 and 10^9 . You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between 1 and 10^9 . Output the minimum number of operations needed such that the resulting array doesn't contain any local maximums, and the resulting array after the operations. An element a_i is a local maximum if it is strictly larger than both of its neighbors (that is, a_i > a_{i - 1} and a_i > a_{i + 1} ). Since a_1 and a_n have only one neighbor each, they will never be a local maximum. Each test contains multiple test cases. The first line will contain a single integer t (1 <= q t <= q 10000) -- the number of test cases. Then t test cases follow. The first line of each test case contains a single integer n (2 <= q n <= q 2 cdot 10^5) -- the size of the array a . The second line of each test case contains n integers a_1, a_2, ldots ,a_n (1 <= q a_i <= q 10^9) , the elements of array. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, first output a line containing a single integer m -- minimum number of operations required. Then ouput a line consist of n integers -- the resulting array after the operations. Note that this array should differ in exactly m elements from the initial array. If there are multiple answers, print any. In the first example, the array contains no local maximum, so we don't need to perform operations. In the second example, we can change a_2 to 3 , then the array don't have local maximums. "...

Tutorials

Codeforces Round #772 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
147105578 dean.menezes B Feb. 20, 2022, 6:14 p.m. OK Clang++17 Diagnostics TESTS 26 202 716800
147122429 gxlois B Feb. 20, 2022, 10:50 p.m. OK GNU C11 TESTS 26 842 819200
147117211 Vedansh_Agrawal B Feb. 20, 2022, 8:47 p.m. OK GNU C11 TESTS 26 873 819200
147091099 wtwq B Feb. 20, 2022, 4:17 p.m. OK GNU C11 TESTS 26 888 819200
147094659 kunaljain7069 B Feb. 20, 2022, 4:27 p.m. OK GNU C11 TESTS 26 889 819200
147101462 rainboy B Feb. 20, 2022, 5:48 p.m. OK GNU C11 TESTS 26 919 1024000
147093676 mounir.bahtat B Feb. 20, 2022, 4:24 p.m. OK GNU C11 TESTS 26 920 819200
147105883 predawn B Feb. 20, 2022, 6:17 p.m. OK GNU C11 TESTS 26 920 819200
147138265 YangTY B Feb. 21, 2022, 5:02 a.m. OK GNU C++14 TESTS 26 31 17612800
147124455 Dina_Mostafa B Feb. 20, 2022, 11:58 p.m. OK GNU C++14 TESTS 26 77 819200
147131306 lqhsmash B Feb. 21, 2022, 2:59 a.m. OK GNU C++14 TESTS 26 78 1638400
147141020 assiduous27 B Feb. 21, 2022, 5:39 a.m. OK GNU C++14 TESTS 26 93 819200
147139384 siddhipiddi B Feb. 21, 2022, 5:18 a.m. OK GNU C++14 TESTS 26 93 819200
147139282 Akif_Azwad B Feb. 21, 2022, 5:16 a.m. OK GNU C++14 TESTS 26 93 819200
147136125 Vishal043 B Feb. 21, 2022, 4:29 a.m. OK GNU C++14 TESTS 26 93 819200
147134562 harsha314 B Feb. 21, 2022, 4:03 a.m. OK GNU C++14 TESTS 26 93 819200
147133541 simplekind B Feb. 21, 2022, 3:45 a.m. OK GNU C++14 TESTS 26 93 819200
147142048 Debargha-Mitra-Roy B Feb. 21, 2022, 5:53 a.m. OK GNU C++14 TESTS 26 93 819200
147102268 Avijit_Chowdhury B Feb. 20, 2022, 5:52 p.m. OK GNU C++17 TESTS 26 31 921600
147127012 bkifhr9 B Feb. 21, 2022, 1:26 a.m. OK GNU C++17 TESTS 26 78 1024000
147119890 payday3 B Feb. 20, 2022, 9:43 p.m. OK GNU C++17 TESTS 26 92 819200
147139484 d283gandhi B Feb. 21, 2022, 5:19 a.m. OK GNU C++17 TESTS 26 93 819200
147141361 sQ-nax- B Feb. 21, 2022, 5:44 a.m. OK GNU C++17 TESTS 26 93 819200
147141587 Mr.Ayhan_1849 B Feb. 21, 2022, 5:47 a.m. OK GNU C++17 TESTS 26 93 819200
147140413 Always_tle B Feb. 21, 2022, 5:32 a.m. OK GNU C++17 TESTS 26 93 819200
147141050 Aizen4325 B Feb. 21, 2022, 5:39 a.m. OK GNU C++17 TESTS 26 93 819200
147140170 Calanosay B Feb. 21, 2022, 5:29 a.m. OK GNU C++17 TESTS 26 93 819200
147140021 uewbv B Feb. 21, 2022, 5:27 a.m. OK GNU C++17 TESTS 26 93 819200
147115171 openmi B Feb. 20, 2022, 8:12 p.m. OK GNU C++17 (64) TESTS 26 62 819200
147133767 ashok2605 B Feb. 21, 2022, 3:49 a.m. OK GNU C++17 (64) TESTS 26 62 819200
147131617 Goddan. B Feb. 21, 2022, 3:06 a.m. OK GNU C++17 (64) TESTS 26 62 819200
147124117 froggyzhang B Feb. 20, 2022, 11:45 p.m. OK GNU C++17 (64) TESTS 26 62 819200
147117619 Vax B Feb. 20, 2022, 8:55 p.m. OK GNU C++17 (64) TESTS 26 62 819200
147116777 Greedious B Feb. 20, 2022, 8:40 p.m. OK GNU C++17 (64) TESTS 26 62 819200
147115654 JumanAlhayajneh B Feb. 20, 2022, 8:20 p.m. OK GNU C++17 (64) TESTS 26 62 819200
147111761 inksamurai B Feb. 20, 2022, 7:22 p.m. OK GNU C++17 (64) TESTS 26 62 819200
147107713 dgupta0812 B Feb. 20, 2022, 6:33 p.m. OK GNU C++17 (64) TESTS 26 62 819200
147106807 I_Love_Someone B Feb. 20, 2022, 6:25 p.m. OK GNU C++17 (64) TESTS 26 62 819200
147136156 Krishna_123 B Feb. 21, 2022, 4:29 a.m. OK GNU C++20 (64) TESTS 26 46 819200
147133738 dk0001 B Feb. 21, 2022, 3:48 a.m. OK GNU C++20 (64) TESTS 26 46 819200
147132905 Venti_chai B Feb. 21, 2022, 3:32 a.m. OK GNU C++20 (64) TESTS 26 46 819200
147131831 Spectre97 B Feb. 21, 2022, 3:11 a.m. OK GNU C++20 (64) TESTS 26 46 819200
147137512 _arcade B Feb. 21, 2022, 4:52 a.m. OK GNU C++20 (64) TESTS 26 46 819200
147138198 Bu1bu1 B Feb. 21, 2022, 5:01 a.m. OK GNU C++20 (64) TESTS 26 46 819200
147139005 generic_placeholder_name B Feb. 21, 2022, 5:12 a.m. OK GNU C++20 (64) TESTS 26 46 819200
147139615 Kali1314 B Feb. 21, 2022, 5:21 a.m. OK GNU C++20 (64) TESTS 26 46 819200
147139619 Time_JYF B Feb. 21, 2022, 5:21 a.m. OK GNU C++20 (64) TESTS 26 46 819200
147140368 Tiglon B Feb. 21, 2022, 5:31 a.m. OK GNU C++20 (64) TESTS 26 46 819200
147137837 MarcelShi_96 B Feb. 21, 2022, 4:56 a.m. OK Go TESTS 26 187 4403200
147111156 clyring B Feb. 20, 2022, 7:14 p.m. OK Haskell TESTS 26 140 16793600
147136485 ND_ B Feb. 21, 2022, 4:35 a.m. OK Java 11 TESTS 26 218 0
147108299 Andwerp B Feb. 20, 2022, 6:39 p.m. OK Java 11 TESTS 26 233 0
147103080 Satyaa B Feb. 20, 2022, 5:57 p.m. OK Java 11 TESTS 26 233 0
147131802 gawsfbet B Feb. 21, 2022, 3:10 a.m. OK Java 11 TESTS 26 249 0
147139473 mayank.singh19 B Feb. 21, 2022, 5:19 a.m. OK Java 11 TESTS 26 264 0
147129145 __Serendipity B Feb. 21, 2022, 2:28 a.m. OK Java 11 TESTS 26 265 0
147124504 pepelats B Feb. 20, 2022, 11:59 p.m. OK Java 11 TESTS 26 265 0
147092372 MadDuke B Feb. 20, 2022, 4:20 p.m. OK Java 11 TESTS 26 280 0
147124452 bobib B Feb. 20, 2022, 11:58 p.m. OK Java 11 TESTS 26 280 0
147112909 jyoti360 B Feb. 20, 2022, 7:38 p.m. OK Java 11 TESTS 26 280 0
147109528 dev_14 B Feb. 20, 2022, 6:53 p.m. OK Java 8 TESTS 26 186 2867200
147111847 adi_daredevil B Feb. 20, 2022, 7:23 p.m. OK Java 8 TESTS 26 186 2867200
147107910 arutsudar B Feb. 20, 2022, 6:35 p.m. OK Java 8 TESTS 26 187 2867200
147104085 nomadicjuggrnaut B Feb. 20, 2022, 6:03 p.m. OK Java 8 TESTS 26 187 2867200
147093649 Shivam_Tripathi B Feb. 20, 2022, 4:24 p.m. OK Java 8 TESTS 26 187 2867200
147139171 gssakash B Feb. 21, 2022, 5:14 a.m. OK Java 8 TESTS 26 202 3072000
147103800 amit_roy B Feb. 20, 2022, 6:01 p.m. OK Java 8 TESTS 26 217 18636800
147117390 malekelkassas B Feb. 20, 2022, 8:51 p.m. OK Java 8 TESTS 26 249 27443200
147136993 sahilarora156 B Feb. 21, 2022, 4:43 a.m. OK Java 8 TESTS 26 483 4198400
147103740 Manas_16 B Feb. 20, 2022, 6:01 p.m. OK Java 8 TESTS 26 779 0
147094573 bernardofbbraga B Feb. 20, 2022, 4:26 p.m. OK JavaScript TESTS 26 249 43315200
147138059 _Astron B Feb. 21, 2022, 4:59 a.m. OK Kotlin 1.4 TESTS 26 218 12595200
147106670 ryanberg B Feb. 20, 2022, 6:24 p.m. OK Kotlin 1.5 TESTS 26 390 4812800
147142225 fragilistic B Feb. 21, 2022, 5:55 a.m. OK Mono C# TESTS 26 732 27648000
147132731 wellorbetter B Feb. 21, 2022, 3:28 a.m. OK MS C++ 2017 TESTS 26 124 819200
147094308 tatianyi B Feb. 20, 2022, 4:26 p.m. OK MS C++ 2017 TESTS 26 140 819200
147094162 whswhswhs B Feb. 20, 2022, 4:25 p.m. OK MS C++ 2017 TESTS 26 233 1638400
147096409 MateiCv B Feb. 20, 2022, 4:31 p.m. OK MS C++ 2017 TESTS 26 311 819200
147112144 MaltaDreamer B Feb. 20, 2022, 7:27 p.m. OK MS C++ 2017 TESTS 26 311 2662400
147093406 coffeeflake B Feb. 20, 2022, 4:23 p.m. OK MS C++ 2017 TESTS 26 312 1024000
147139758 klpiguy B Feb. 21, 2022, 5:23 a.m. OK MS C++ 2017 TESTS 26 327 819200
147113526 mahmoud_saad B Feb. 20, 2022, 7:46 p.m. OK MS C++ 2017 TESTS 26 327 1740800
147097454 Dybulina_Anna B Feb. 20, 2022, 4:34 p.m. OK MS C++ 2017 TESTS 26 342 2048000
147091644 ftpud B Feb. 20, 2022, 4:18 p.m. OK .NET Core C# TESTS 26 187 30822400
147141140 Zeroop B Feb. 21, 2022, 5:41 a.m. OK Node.js TESTS 26 295 31436800
147101791 1_2_3_4_5_9 B Feb. 20, 2022, 5:50 p.m. OK PyPy 2 TESTS 26 248 17305600
147095605 OLOGY B Feb. 20, 2022, 4:29 p.m. OK PyPy 2 TESTS 26 311 16179200
147103347 abhishekk_7 B Feb. 20, 2022, 5:58 p.m. OK PyPy 3 TESTS 26 187 20992000
147111055 lebron87 B Feb. 20, 2022, 7:12 p.m. OK PyPy 3 TESTS 26 421 26214400
147096501 Hqxor B Feb. 20, 2022, 4:32 p.m. OK PyPy 3 TESTS 26 451 17920000
147115951 whatshisbucket B Feb. 20, 2022, 8:25 p.m. OK PyPy 3 TESTS 26 452 17920000
147103661 _hurayra B Feb. 20, 2022, 6 p.m. OK PyPy 3 TESTS 26 452 20582400
147121362 toam B Feb. 20, 2022, 10:19 p.m. OK PyPy 3 TESTS 26 483 19456000
147127256 grawlixes B Feb. 21, 2022, 1:34 a.m. OK PyPy 3 TESTS 26 483 24371200
147102698 harshitgarg02 B Feb. 20, 2022, 5:55 p.m. OK PyPy 3 TESTS 26 514 19558400
147103637 Fatduck B Feb. 20, 2022, 6 p.m. OK PyPy 3 TESTS 26 561 28467200
147112302 chemistry_guy B Feb. 20, 2022, 7:29 p.m. OK PyPy 3 TESTS 26 592 26419200
147104465 NKUCristiano B Feb. 20, 2022, 6:06 p.m. OK PyPy 3-64 TESTS 26 187 29900800
147104775 mayank35 B Feb. 20, 2022, 6:08 p.m. OK PyPy 3-64 TESTS 26 202 28364800
147139735 sakshatmali B Feb. 21, 2022, 5:23 a.m. OK PyPy 3-64 TESTS 26 265 31334400
147134494 aman404found B Feb. 21, 2022, 4:02 a.m. OK PyPy 3-64 TESTS 26 421 28364800
147092933 ganesh_singh B Feb. 20, 2022, 4:22 p.m. OK PyPy 3-64 TESTS 26 436 27852800
147127745 sjNxksbzj B Feb. 21, 2022, 1:50 a.m. OK PyPy 3-64 TESTS 26 452 28672000
147123078 gaelanmcm B Feb. 20, 2022, 11:10 p.m. OK PyPy 3-64 TESTS 26 467 27852800
147128648 rutz12 B Feb. 21, 2022, 2:15 a.m. OK PyPy 3-64 TESTS 26 467 28364800
147137398 hardik2001 B Feb. 21, 2022, 4:50 a.m. OK PyPy 3-64 TESTS 26 467 29388800
147132713 mnkp B Feb. 21, 2022, 3:28 a.m. OK PyPy 3-64 TESTS 26 468 28364800
147105573 OLOGY B Feb. 20, 2022, 6:14 p.m. OK Python 2 TESTS 26 187 14848000
147103779 HurayraIIT B Feb. 20, 2022, 6:01 p.m. OK Python 3 TESTS 26 234 17203200
147120727 Apollo-Roboto B Feb. 20, 2022, 10:03 p.m. OK Python 3 TESTS 26 280 17100800
147125856 Ibne_Hassan B Feb. 21, 2022, 12:46 a.m. OK Python 3 TESTS 26 311 17100800
147137924 RahilShah2002 B Feb. 21, 2022, 4:57 a.m. OK Python 3 TESTS 26 311 17203200
147103122 Tahmid406 B Feb. 20, 2022, 5:57 p.m. OK Python 3 TESTS 26 311 19148800
147090946 WenqingWenqing B Feb. 20, 2022, 4:16 p.m. OK Python 3 TESTS 26 327 17100800
147133032 mayank26596 B Feb. 21, 2022, 3:34 a.m. OK Python 3 TESTS 26 373 20070400
147131634 khanhtoan38 B Feb. 21, 2022, 3:06 a.m. OK Python 3 TESTS 26 374 15769600
147101804 Ecola B Feb. 20, 2022, 5:50 p.m. OK Python 3 TESTS 26 389 16076800
147133305 abhijeet.panihar.cse20 B Feb. 21, 2022, 3:39 a.m. OK Python 3 TESTS 26 389 16179200
147125705 Spheniscine B Feb. 21, 2022, 12:41 a.m. OK Rust 2021 TESTS 26 46 5734400
147104803 zlfn B Feb. 20, 2022, 6:08 p.m. OK Rust 2021 TESTS 26 218 6348800
147113537 Hyrulia B Feb. 20, 2022, 7:46 p.m. OK Rust 2021 TESTS 26 249 6246400

remove filters

Back to search problems