Codeforces Round 980 (Div. 1)

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
2023 Codeforces Round 980 (Div. 1) FINISHED False 7200 46990523 Oct. 20, 2024, 9:05 a.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 132 ) F Hills and Pits PROGRAMMING data structures data structures math math

In a desert city with a hilly landscape, the city hall decided to level the road surface by purchasing a dump truck. The road is divided into (n) sections, numbered from (1) to (n) from left to right. The height of the surface in the (i)-th section is equal to (a_i). If the height of the (i)-th section is greater than (0), then the dump truck must take sand from the (i)-th section of the road, and if the height of the (i)-th section is less than (0), the dump truck must fill the pit in the (i)-th section of the road with sand. It is guaranteed that the initial heights are not equal to (0). When the dump truck is in the (i)-th section of the road, it can either take away (x) units of sand, in which case the height of the surface in the (i)-th section will decrease by (x), or it can fill in (x) units of sand (provided that it currently has at least (x) units of sand in its bed), in which case the height of the surface in the (i)-th section of the road will increase by (x). The dump truck can start its journey from any section of the road. Moving to an adjacent section on the left or right takes (1) minute, and the time for loading and unloading sand can be neglected. The dump truck has an infinite capacity and is initially empty. You need to find the minimum time required for the dump truck to level the sand so that the height in each section becomes equal to (0). Note that after all movements, the dump truck may still have sand left in its bed . You need to solve this problem independently for the segments numbered from (l_i) to (r_i). Sand outside the segment cannot be used. Each test consists of multiple test cases. The first line contains a single integer (t) ((1 \le t \le 10^4)) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers (n) and (q) ($$$1 \le n, q \le 3 \cdot 10

Tutorials

135341

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
287136780 A_G F Oct. 21, 2024, 2:01 a.m. OK C++20 (GCC 13-64) TESTS 36 827 37683200
287043650 maspy F Oct. 20, 2024, 12:13 p.m. OK C++20 (GCC 13-64) TESTS 36 905 69734400
287145746 Str0nger F Oct. 21, 2024, 4:34 a.m. OK C++20 (GCC 13-64) TESTS 36 1311 56627200
287085195 dorijanlendvaj F Oct. 20, 2024, 3:26 p.m. OK C++20 (GCC 13-64) TESTS 36 1468 67584000
287139834 nbhoanh09hanoi F Oct. 21, 2024, 3:11 a.m. OK C++20 (GCC 13-64) TESTS 36 1640 166400000
287100197 -Eternity- F Oct. 20, 2024, 5:19 p.m. OK C++20 (GCC 13-64) TESTS 36 1686 166604800
287027962 dorijanlendvaj F Oct. 20, 2024, noon OK C++20 (GCC 13-64) TESTS 36 1983 68710400
287042299 ksun48 F Oct. 20, 2024, 12:06 p.m. OK C++20 (GCC 13-64) TESTS 36 2749 68608000
287042381 Farhod F Oct. 20, 2024, 12:07 p.m. OK C++23 (GCC 14-64, msys2) TESTS 36 874 57651200
287034743 Farhod F Oct. 20, 2024, noon OK C++23 (GCC 14-64, msys2) TESTS 36 936 54067200
287140141 Dominater069 F Oct. 21, 2024, 3:16 a.m. OK C++23 (GCC 14-64, msys2) TESTS 36 1093 76185600
287072234 maroonrk F Oct. 20, 2024, 1:52 p.m. OK C++23 (GCC 14-64, msys2) TESTS 36 1109 101580800
287014608 jiangly F Oct. 20, 2024, 11:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 36 1421 56729600
287085352 Benq F Oct. 20, 2024, 3:27 p.m. OK C++23 (GCC 14-64, msys2) TESTS 36 1733 89600000
287085768 Benq F Oct. 20, 2024, 3:31 p.m. OK C++23 (GCC 14-64, msys2) TESTS 36 1796 93286400

remove filters

Back to search problems