Codeforces Round 1021 (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
2097 Codeforces Round 1021 (Div. 1) FINISHED False 10800 30749123 April 26, 2025, 8:35 a.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 271 ) E Clearing the Snowdrift PROGRAMMING data structures

Boy Vasya loves to travel very much. In particular, flying in airplanes brings him extraordinary pleasure. He was about to fly to another city, but the runway was heavily covered with snow and needed to be cleared. The runway can be represented as (n) consecutive sections numbered from (1) to (n). The snowstorm was quite strong, but it has already stopped, so Vasya managed to calculate that the (i)-th section is covered with (a_i) meters of snow. For such situations, the airport has a snowplow that works in a rather unusual way. In one minute, the snowplow can do the following: Choose a consecutive segment of length no more than (d) and remove one meter of snow from the most snow-covered sections. Formally, one can choose (1 \le l \le r \le n) ((r - l + 1 \le d)). After that, (c = \max \{ a_l, a_{l + 1}, \ldots , a_r \}) is calculated, and if (c > 0), then for all (i \colon l \le i \le r) such that (a_i = c), the value of (a_i) is decreased by one. Formally, one can choose (1 \le l \le r \le n) ((r - l + 1 \le d)). After that, (c = \max \{ a_l, a_{l + 1}, \ldots , a_r \}) is calculated, and if (c > 0), then for all (i \colon l \le i \le r) such that (a_i = c), the value of (a_i) is decreased by one. Vasya has been preparing for the flight for a long time and wants to understand how much time he has left to wait until all sections are completely cleared of snow. In other words, it is required to calculate the minimum number of minutes that the snowplow will need to achieve (a_i = 0) for all (i) from (1) to (n). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 2 \cdot 10^5)). The description of the test cases follows. The first line of each test case contains two integers (n) and (d) ((1 \le n \le 5 \cdot 10^5, 1 \le d \le n)) — the number of sections on the runway and the maximum length

Tutorials

142316

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
317391430 AiPd E April 26, 2025, 9:06 p.m. OK C++17 (GCC 7-32) TESTS 47 671 14131200
317319809 qwef_ E April 26, 2025, 11:03 a.m. OK C++17 (GCC 7-32) TESTS 47 921 806604800
317333527 nikolapesic2802 E April 26, 2025, 12:32 p.m. OK C++17 (GCC 7-32) TESTS 47 1249 142336000
317401645 Enoch006 E April 27, 2025, 1:03 a.m. OK C++17 (GCC 7-32) TESTS 47 1359 56115200
317333681 nikolapesic2802 E April 26, 2025, 12:33 p.m. OK C++17 (GCC 7-32) TESTS 47 1452 47513600
317304189 orzdevinwang E April 26, 2025, 9:54 a.m. OK C++17 (GCC 7-32) TESTS 47 1484 33075200
317406068 jiangbowen E April 27, 2025, 3:01 a.m. OK C++17 (GCC 7-32) TESTS 47 1577 58265600
317305664 potato167 E April 26, 2025, 10 a.m. OK C++17 (GCC 7-32) TESTS 47 1687 47923200
317321088 jiangbowen E April 26, 2025, 11:09 a.m. OK C++17 (GCC 7-32) TESTS 47 1733 58163200
317332700 nikolapesic2802 E April 26, 2025, 12:26 p.m. OK C++17 (GCC 7-32) TESTS 47 1952 142336000
317408329 kilomiles E April 27, 2025, 3:53 a.m. OK C++20 (GCC 13-64) TESTS 47 765 272179200
317335772 NKheyuxiang E April 26, 2025, 12:48 p.m. OK C++20 (GCC 13-64) TESTS 47 999 14028800
317321389 dlalswp25 E April 26, 2025, 11:10 a.m. OK C++20 (GCC 13-64) TESTS 47 1046 30003200
317367547 jeroenodb E April 26, 2025, 5:35 p.m. OK C++20 (GCC 13-64) TESTS 47 1061 36454400
317411211 kevinyang E April 27, 2025, 5 a.m. OK C++20 (GCC 13-64) TESTS 47 1077 50176000
317313597 cxm1024 E April 26, 2025, 10:34 a.m. OK C++20 (GCC 13-64) TESTS 47 1155 19763200
317400436 KingOfGenshin E April 27, 2025, 12:27 a.m. OK C++20 (GCC 13-64) TESTS 47 1187 38912000
317321182 fallleaves01 E April 26, 2025, 11:09 a.m. OK C++20 (GCC 13-64) TESTS 47 1296 25702400
317398318 Radewoosh E April 26, 2025, 11:24 p.m. OK C++20 (GCC 13-64) TESTS 47 1296 142540800
317299854 tourist E April 26, 2025, 9:37 a.m. OK C++20 (GCC 13-64) TESTS 47 1374 43417600
317333207 snuke E April 26, 2025, 12:30 p.m. OK C++23 (GCC 14-64, msys2) TESTS 47 827 20582400
317348805 cdxcdxcdxcdx E April 26, 2025, 2:31 p.m. OK C++23 (GCC 14-64, msys2) TESTS 47 921 1014067200
317333531 N_z__ E April 26, 2025, 12:32 p.m. OK C++23 (GCC 14-64, msys2) TESTS 47 984 806195200
317332927 snuke E April 26, 2025, 12:28 p.m. OK C++23 (GCC 14-64, msys2) TESTS 47 1015 20480000
317333070 snuke E April 26, 2025, 12:29 p.m. OK C++23 (GCC 14-64, msys2) TESTS 47 1062 20480000
317315612 rqoi031 E April 26, 2025, 10:44 a.m. OK C++23 (GCC 14-64, msys2) TESTS 47 1062 34201600
317322644 Noam527 E April 26, 2025, 11:16 a.m. OK C++23 (GCC 14-64, msys2) TESTS 47 1124 18534400
317308313 244mhq E April 26, 2025, 10:11 a.m. OK C++23 (GCC 14-64, msys2) TESTS 47 1124 35942400
317304951 hos.lyric E April 26, 2025, 9:57 a.m. OK C++23 (GCC 14-64, msys2) TESTS 47 1156 42496000
317407540 diandian2020 E April 27, 2025, 3:35 a.m. OK C++23 (GCC 14-64, msys2) TESTS 47 1156 491008000
317365634 ahmedafeef E April 26, 2025, 5:19 p.m. OK GNU C11 TESTS 47 1015 14131200
317367174 ahmedafeef E April 26, 2025, 5:32 p.m. OK GNU C11 TESTS 47 1077 14233600
317377766 arnabmanna E April 26, 2025, 6:55 p.m. OK Java 8 TESTS 47 1640 32870400
317407128 sansen E April 27, 2025, 3:26 a.m. OK Rust 2021 TESTS 47 999 33280000

remove filters

Back to search problems