Codeforces Round 971 (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
2009 Codeforces Round 971 (Div. 4) FINISHED False 9000 51031523 Sept. 3, 2024, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 524 ) G3 Yunli's Subarray Queries (extreme version) PROGRAMMING data structures trees

This is the extreme version of the problem. In this version, the output of each query is different from the easy and hard versions. It is also guaranteed that (r \geq l+k-1) for all queries. For an arbitrary array (b), Yunli can perform the following operation any number of times: Select an index (i). Set (b_i = x) where (x) is any integer she desires ((x) is not limited to the interval (1,n)). Denote (f(b)) as the minimum number of operations she needs to perform until there exists a consecutive subarray(^{\text{∗}}) of length at least (k) in (b). Yunli is given an array (a) of size (n) and asks you (q) queries. In each query, you must output (\sum_{i=l}^{r-k+1} \sum_{j=i+k-1}^{r} f(a_i, a_{i+1}, \ldots, a_j)). (^{\text{∗}})If there exists a consecutive subarray of length (k) that starts at index (i) ((1 \leq i \leq |b|-k+1)), then (b_j = b_{j-1} + 1) for all (i < j \leq i+k-1). The first line contains (t) ((1 \leq t \leq 10^4)) — the number of test cases. The first line of each test case contains three integers (n), (k), and (q) ((1 \leq k \leq n \leq 2 \cdot 10^5), (1 \leq q \leq 2 \cdot 10^5)) — the length of the array, the length of the consecutive subarray, and the number of queries. The following line contains (n) integers (a_1, a_2, ..., a_n) ((1 \leq a_i \leq n)). The following (q) lines contain two integers (l) and (r) ((1 \leq l \leq r \leq n), (r \geq l+k-1)) — the bounds of the query. It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5) and the sum of (q) over all test cases does not exceed (2 \cdot 10^5). Output (\sum_{i=l}^{r-k+1} \sum_{j=i+k-1}^{r} f(a_i, a_{i+1}, \ldots, a_j)) for each query on a new line. In the first query of the first testcase, we can calculate the answer for the query through the following: (i = 4) and (j = 5)

Tutorials

Codeforces Round 971 (Div. 4) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
279751475 LEFt_bank G3 Sept. 4, 2024, 5 a.m. OK C++17 (GCC 7-32) TESTS 31 327 32051200
279742384 3month7 G3 Sept. 4, 2024, 3:06 a.m. OK C++17 (GCC 7-32) TESTS 31 453 53043200
279728894 Sparkle_Twilight G3 Sept. 3, 2024, 10:47 p.m. OK C++17 (GCC 7-32) TESTS 31 827 72704000
279653196 temporary1 G3 Sept. 3, 2024, 6:57 p.m. OK C++17 (GCC 7-32) TESTS 31 1015 24064000
279740237 omeganot G3 Sept. 4, 2024, 2:32 a.m. OK C++17 (GCC 7-32) TESTS 31 1062 49356800
279654911 0wuming0 G3 Sept. 3, 2024, 7:16 p.m. OK C++17 (GCC 7-32) TESTS 31 1328 67686400
279642326 Darko1 G3 Sept. 3, 2024, 5:19 p.m. OK C++17 (GCC 7-32) TESTS 31 1452 50073600
279739330 Code937 G3 Sept. 4, 2024, 2:16 a.m. OK C++17 (GCC 7-32) TESTS 31 2906 111616000
279745704 LNian G3 Sept. 4, 2024, 3:52 a.m. OK C++20 (GCC 13-64) TESTS 31 327 41574400
279742699 mathwing G3 Sept. 4, 2024, 3:11 a.m. OK C++20 (GCC 13-64) TESTS 31 342 179609600
279744598 Brrr23 G3 Sept. 4, 2024, 3:37 a.m. OK C++20 (GCC 13-64) TESTS 31 343 21504000
279735181 ImmortaLimit G3 Sept. 4, 2024, 1 a.m. OK C++20 (GCC 13-64) TESTS 31 358 62668800
279742148 EnofTaiPeople G3 Sept. 4, 2024, 3:02 a.m. OK C++20 (GCC 13-64) TESTS 31 406 292044800
279642638 fishcathu. G3 Sept. 3, 2024, 5:22 p.m. OK C++20 (GCC 13-64) TESTS 31 421 59494400
279747684 fishcathu. G3 Sept. 4, 2024, 4:15 a.m. OK C++20 (GCC 13-64) TESTS 31 452 56422400
279642746 2018LZY G3 Sept. 3, 2024, 5:22 p.m. OK C++20 (GCC 13-64) TESTS 31 499 72294400
279649312 qfl_zzz G3 Sept. 3, 2024, 6:19 p.m. OK C++20 (GCC 13-64) TESTS 31 530 96153600
279679120 qfl_zzz G3 Sept. 3, 2024, 7:55 p.m. OK C++20 (GCC 13-64) TESTS 31 546 83558400
279643462 SparshMittal G3 Sept. 3, 2024, 5:28 p.m. OK C++23 (GCC 14-64, msys2) TESTS 31 421 37580800
279747329 orztanangkad G3 Sept. 4, 2024, 4:11 a.m. OK C++23 (GCC 14-64, msys2) TESTS 31 483 39014400
279747522 orztanangkad G3 Sept. 4, 2024, 4:13 a.m. OK C++23 (GCC 14-64, msys2) TESTS 31 515 36454400
279756530 Junz_LJL G3 Sept. 4, 2024, 5:54 a.m. OK C++23 (GCC 14-64, msys2) TESTS 31 608 252416000
279679280 lcyxds G3 Sept. 3, 2024, 7:56 p.m. OK C++23 (GCC 14-64, msys2) TESTS 31 733 63590400
279732881 pengyantong G3 Sept. 4, 2024, 12:17 a.m. OK C++23 (GCC 14-64, msys2) TESTS 31 733 77619200
279745080 oversolver G3 Sept. 4, 2024, 3:44 a.m. OK PyPy 3-64 TESTS 31 2046 186982400
279745555 oversolver G3 Sept. 4, 2024, 3:50 a.m. OK PyPy 3-64 TESTS 31 2124 186777600
279745701 Spheniscine G3 Sept. 4, 2024, 3:52 a.m. OK Rust 2021 TESTS 31 343 48025600
279748327 Spheniscine G3 Sept. 4, 2024, 4:24 a.m. OK Rust 2021 TESTS 31 359 48025600

remove filters

Back to search problems