Codeforces Round 1062 (Div. 4)

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
2167 Codeforces Round 1062 (Div. 4) FINISHED False 8100 14743523 Oct. 28, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 10831 ) G Mukhammadali and the Smooth Array PROGRAMMING data structures dp

Muhammadali has an integer array (a_1,\dots,a_n). He can change (replace) any subset of positions; changing position (i) costs (c_i) and replaces (a_i) with any integer of his choice. The positions that he does not change must retain their original values. After all changes, we call an index (i) ((1 \le i < n)) a drop if the final value at position (i) is strictly greater than the final value at position (i+1). Muhammadali wants the final array to contain no drops . Find the minimum cost of changes required to ensure that there are no drops in the array. The first line contains an integer (t) ((1 \le t \le 5000)) — the number of test cases. Each test case consists of three lines: The first line contains a single integer (n) ((1 \le n \le 8000)) — the length of the arrays. The second line contains (n) integers (a_1, a_2, \dots, a_n) ((1 \le a_i \le 10^9)) — the elements of the array. The third line contains (n) integers (c_1, c_2, \dots, c_n) ((1 \le c_i \le 10^9)) — the costs of changes. It is guaranteed that the sum of (n) across all test cases does not exceed (8000). For each test case, output a single integer — the minimum possible total cost required to eliminate all drops . In the first and second examples, the array already has no drops , so no changes are needed. In the third example, one of the optimal arrays is: (2,3,5,6); to achieve this, all elements except the second need to be replaced, so the answer is (c_1 + c_3 + c_4 = 3).

Tutorials

Arpa Video Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
346378178 ksandr1v G Oct. 28, 2025, 7:56 p.m. OK C# 13 TESTS 36 265 1945600
346528539 Ali_Adelkhah G Oct. 29, 2025, 7:44 p.m. OK C++17 (GCC 7-32) TESTS 36 62 0
346524937 MrPavlito G Oct. 29, 2025, 7:10 p.m. OK C++17 (GCC 7-32) TESTS 36 62 0
346568962 ihapiw G Oct. 30, 2025, 5:14 a.m. OK C++17 (GCC 7-32) TESTS 36 62 102400
346546289 SF-Manman G Oct. 30, 2025, 12:47 a.m. OK C++17 (GCC 7-32) TESTS 36 62 102400
346496949 lhlephuocdao G Oct. 29, 2025, 4:18 p.m. OK C++17 (GCC 7-32) TESTS 36 62 102400
346412186 soju_ G Oct. 29, 2025, 5:10 a.m. OK C++17 (GCC 7-32) TESTS 36 62 204800
346531510 Ali_Adelkhah G Oct. 29, 2025, 8:13 p.m. OK C++17 (GCC 7-32) TESTS 36 77 0
346506879 vignatej G Oct. 29, 2025, 5:10 p.m. OK C++17 (GCC 7-32) TESTS 36 77 0
346498375 lhlephuocdao G Oct. 29, 2025, 4:26 p.m. OK C++17 (GCC 7-32) TESTS 36 77 0
346497627 lhlephuocdao G Oct. 29, 2025, 4:22 p.m. OK C++17 (GCC 7-32) TESTS 36 77 0
346410138 qiqi_0507sinan G Oct. 29, 2025, 4:48 a.m. OK C++20 (GCC 13-64) TESTS 36 61 0
346561041 ja1u0va G Oct. 30, 2025, 3:57 a.m. OK C++20 (GCC 13-64) TESTS 36 61 102400
346548154 cosenza G Oct. 30, 2025, 1:23 a.m. OK C++20 (GCC 13-64) TESTS 36 61 102400
346555003 ZHXS G Oct. 30, 2025, 2:46 a.m. OK C++20 (GCC 13-64) TESTS 36 62 0
346538541 Zoz G Oct. 29, 2025, 9:54 p.m. OK C++20 (GCC 13-64) TESTS 36 62 0
346537849 jackylova_fan_fan_fan G Oct. 29, 2025, 9:40 p.m. OK C++20 (GCC 13-64) TESTS 36 62 0
346406748 Hijeff G Oct. 29, 2025, 4:03 a.m. OK C++20 (GCC 13-64) TESTS 36 62 0
346405665 limits08 G Oct. 29, 2025, 3:49 a.m. OK C++20 (GCC 13-64) TESTS 36 62 0
346572842 Light_Cone G Oct. 30, 2025, 5:51 a.m. OK C++20 (GCC 13-64) TESTS 36 62 102400
346567217 FlowerandYou G Oct. 30, 2025, 4:55 a.m. OK C++20 (GCC 13-64) TESTS 36 62 102400
346564713 SkyEyeController G Oct. 30, 2025, 4:27 a.m. OK C++23 (GCC 14-64, msys2) TESTS 36 46 0
346410956 BindaasBoy G Oct. 29, 2025, 4:58 a.m. OK C++23 (GCC 14-64, msys2) TESTS 36 46 102400
346397003 lfx-9877 G Oct. 29, 2025, 1:27 a.m. OK C++23 (GCC 14-64, msys2) TESTS 36 46 102400
346396029 IceBorworntat G Oct. 29, 2025, 1:04 a.m. OK C++23 (GCC 14-64, msys2) TESTS 36 46 204800
346410536 puru_2.0 G Oct. 29, 2025, 4:53 a.m. OK C++23 (GCC 14-64, msys2) TESTS 36 61 0
346399125 jqSnowz G Oct. 29, 2025, 2:11 a.m. OK C++23 (GCC 14-64, msys2) TESTS 36 61 0
346566854 Closet123 G Oct. 30, 2025, 4:51 a.m. OK C++23 (GCC 14-64, msys2) TESTS 36 62 0
346549713 babbrian G Oct. 30, 2025, 1:52 a.m. OK C++23 (GCC 14-64, msys2) TESTS 36 62 0
346548138 Sealy G Oct. 30, 2025, 1:23 a.m. OK C++23 (GCC 14-64, msys2) TESTS 36 62 0
346511312 _X_OR_X_ G Oct. 29, 2025, 5:35 p.m. OK C++23 (GCC 14-64, msys2) TESTS 36 62 0
346414874 xXxNoobSaibotxXx G Oct. 29, 2025, 5:39 a.m. OK GNU C11 TESTS 36 186 307200
346399939 Andrew_G6 G Oct. 29, 2025, 2:26 a.m. OK GNU C11 TESTS 36 280 4915200
346512427 AR_Sijan G Oct. 29, 2025, 5:43 p.m. OK GNU C11 TESTS 36 374 409600
346392329 0x3F G Oct. 28, 2025, 11:14 p.m. OK Go TESTS 36 186 409600
346387721 nikhil478 G Oct. 28, 2025, 9:49 p.m. OK Go TESTS 36 186 614400
346493784 abdullahelshebrawy G Oct. 29, 2025, 4 p.m. OK Go TESTS 36 218 512000
346508176 VaHiX G Oct. 29, 2025, 5:17 p.m. OK Java 21 TESTS 36 281 1536000
346547432 man-ray G Oct. 30, 2025, 1:09 a.m. OK Java 21 TESTS 36 296 921600
346565138 fatal-98 G Oct. 30, 2025, 4:32 a.m. OK Java 21 TESTS 36 390 1536000
346384808 Goutham_808 G Oct. 28, 2025, 9:24 p.m. OK Java 21 TESTS 36 405 716800
346402629 ccj123 G Oct. 29, 2025, 3:05 a.m. OK Java 21 TESTS 36 405 1638400
346407817 minibin G Oct. 29, 2025, 4:17 a.m. OK Java 21 TESTS 36 421 1331200
346494629 GuLLu05 G Oct. 29, 2025, 4:05 p.m. OK Java 21 TESTS 36 421 1536000
346382207 BiggestFish06 G Oct. 28, 2025, 8:42 p.m. OK Java 21 TESTS 36 468 614400
346499945 Kakarot_DB G Oct. 29, 2025, 4:36 p.m. OK Java 21 TESTS 36 468 1228800
346530197 iamyash2004 G Oct. 29, 2025, 8 p.m. OK Java 21 TESTS 36 483 1228800
346535822 sarthaKKharKa_18 G Oct. 29, 2025, 9:06 p.m. OK Java 8 TESTS 36 343 0
346405687 ycnetsisnoc G Oct. 29, 2025, 3:50 a.m. OK Java 8 TESTS 36 358 0
346409870 Racharla_Yagnesh G Oct. 29, 2025, 4:44 a.m. OK Java 8 TESTS 36 374 0
346384274 Shashwata_32 G Oct. 28, 2025, 9:14 p.m. OK Java 8 TESTS 36 374 16998400
346409975 Ragi_Srikanta G Oct. 29, 2025, 4:45 a.m. OK Java 8 TESTS 36 390 0
346521424 Pranav_45 G Oct. 29, 2025, 6:40 p.m. OK Java 8 TESTS 36 405 39014400
346550186 NeelmaniPandey09 G Oct. 30, 2025, 2 a.m. OK Java 8 TESTS 36 436 0
346387928 cobor G Oct. 28, 2025, 9:53 p.m. OK Java 8 TESTS 36 452 0
346385056 yashbansal99 G Oct. 28, 2025, 9:28 p.m. OK Java 8 TESTS 36 467 0
346502404 wanderer1509 G Oct. 29, 2025, 4:51 p.m. OK Java 8 TESTS 36 999 0
346507285 VaHiX G Oct. 29, 2025, 5:12 p.m. OK Kotlin 2.2 TESTS 36 406 0
346405273 LooeyDooey866 G Oct. 29, 2025, 3:44 a.m. OK Kotlin 2.2 TESTS 36 796 1740800
346507133 justinzh678 G Oct. 29, 2025, 5:11 p.m. OK PyPy 3 TESTS 36 842 4505600
346403205 minuki646 G Oct. 29, 2025, 3:13 a.m. OK PyPy 3-64 TESTS 36 140 5222400
346507007 VaHiX G Oct. 29, 2025, 5:11 p.m. OK PyPy 3-64 TESTS 36 140 6041600
346537228 heet.v G Oct. 29, 2025, 9:28 p.m. OK PyPy 3-64 TESTS 36 156 6451200
346573708 yoonsica G Oct. 30, 2025, 5:59 a.m. OK PyPy 3-64 TESTS 36 218 8704000
346492984 gardengnome G Oct. 29, 2025, 3:55 p.m. OK PyPy 3-64 TESTS 36 234 6656000
346409815 gardengnome G Oct. 29, 2025, 4:43 a.m. OK PyPy 3-64 TESTS 36 249 7270400
346379271 SumitKundu G Oct. 28, 2025, 8:08 p.m. OK PyPy 3-64 TESTS 36 280 6860800
346398573 fuyo1622 G Oct. 29, 2025, 2 a.m. OK PyPy 3-64 TESTS 36 296 8499200
346378247 Polynomu G Oct. 28, 2025, 7:56 p.m. OK PyPy 3-64 TESTS 36 296 9216000
346504824 zzz_._nitin G Oct. 29, 2025, 4:58 p.m. OK PyPy 3-64 TESTS 36 343 3481600
346529668 iuyfty G Oct. 29, 2025, 7:54 p.m. OK Python 3 TESTS 36 108 3379200
346561289 Boya_Anil G Oct. 30, 2025, 4 a.m. OK Python 3 TESTS 36 109 2252800
346390831 Daniel0909 G Oct. 28, 2025, 10:29 p.m. OK Python 3 TESTS 36 124 3174400
346384574 jubayeddipu G Oct. 28, 2025, 9:19 p.m. OK Python 3 TESTS 36 140 3276800
346530726 hiung G Oct. 29, 2025, 8:05 p.m. OK Python 3 TESTS 36 187 3686400
346546046 0x81 G Oct. 30, 2025, 12:42 a.m. OK Rust 2024 TESTS 36 140 0

remove filters

Back to search problems