Codeforces Round 1072 (Div. 3)

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
2184 Codeforces Round 1072 (Div. 3) FINISHED False 8100 8177123 Jan. 12, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 2889 ) G Nastiness of Segments PROGRAMMING binary search data structures divide and conquer

Andrey remembered that he has (n) blocks numbered from (1) to (n). On the block with number (i), there is initially an integer (a_i) written. He arranged them in a row in increasing order of their numbers: first is the block with number (1), then the block with number (2), and so on, with the block with number (n) at the end. For a certain segment of consecutive blocks (l, r) ((1 \le l \le r \le n)), we call an integer (d\ (0 \le d \le r-l)) nasty if (\min(a_l, a_{l+1}, \ldots, a_{l+d}) = d). Andrey is very curious, so he wants to perform (q) operations of one of two types: Change the number (a_i) written on the (i)-th block to (x). Determine the nastiness of the segment (l,\ r\ (1 \le l \le r \le n)). The nastiness of the segment refers to the number of nasty numbers (d\ (0 \le d \le r-l)) for the given segment. Andrey couldn't figure out how to process these queries quickly, so he turned to you for help. Help him perform the actions described above! The first line contains an integer (t) ((1 \le t \le 10^4)) — the number of test cases. The first line of each test case contains two integers (n) and (q) ((1 \le n, q \le 2 \cdot 10^5)) — the number of blocks and the number of operations, respectively. The next line contains (n) integers (a_1, a_2, \ldots, a_n) ((1 \le a_i \le 2 \cdot 10^5)) — the initial numbers written on the blocks. The following (q) lines describe the operations to be performed. Each line starts with an integer (idx) ((1 \le idx \le 2)) — the type of operation. If (idx = 1), then two integers (i) ((1 \le i \le n)) and (x) ((1 \le x \le 2 \cdot 10^5)) follow — the description of the first type of operation. If (idx = 2), then two integers (l) and (r) ((1 \le l \le r \le n)) follow — the description of the second type of operation. It is guaranteed that the sum of (n) over all test

Tutorials

Codeforces Round 1072 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
357701250 _Equinox G Jan. 13, 2026, 12:51 p.m. OK C# 13 TESTS 49 328 20787200
357700763 whopassby_fan G Jan. 13, 2026, 12:47 p.m. OK C# 13 TESTS 49 328 20787200
357678007 -firefly- G Jan. 13, 2026, 9:32 a.m. OK C# 13 TESTS 49 546 27443200
357720848 keluadao G Jan. 13, 2026, 3:17 p.m. OK C++17 (GCC 7-32) TESTS 49 375 4096000
357698980 hs.xx G Jan. 13, 2026, 12:33 p.m. OK C++17 (GCC 7-32) TESTS 49 406 10547200
357691614 kavyanshkrishan G Jan. 13, 2026, 11:31 a.m. OK C++17 (GCC 7-32) TESTS 49 453 0
357702642 AdSaw05_ G Jan. 13, 2026, 1:01 p.m. OK C++17 (GCC 7-32) TESTS 49 515 0
357760441 nitin23359 G Jan. 13, 2026, 8:12 p.m. OK C++17 (GCC 7-32) TESTS 49 515 102400
357698851 hs.xx G Jan. 13, 2026, 12:32 p.m. OK C++17 (GCC 7-32) TESTS 49 515 10547200
357786072 dl2718281 G Jan. 14, 2026, 6:03 a.m. OK C++17 (GCC 7-32) TESTS 49 531 3276800
357750742 khaali.khopadi G Jan. 13, 2026, 6:36 p.m. OK C++17 (GCC 7-32) TESTS 49 609 102400
357690146 Me_as_coder G Jan. 13, 2026, 11:18 a.m. OK C++17 (GCC 7-32) TESTS 49 609 1638400
357771600 hgzx G Jan. 14, 2026, 1:31 a.m. OK C++17 (GCC 7-32) TESTS 49 734 4096000
357769053 www_bilibili_com G Jan. 14, 2026, 12:06 a.m. OK C++20 (GCC 13-64) TESTS 49 156 4198400
357755971 Wildlight G Jan. 13, 2026, 7:22 p.m. OK C++20 (GCC 13-64) TESTS 49 187 11980800
357747457 JAY19 G Jan. 13, 2026, 6:14 p.m. OK C++20 (GCC 13-64) TESTS 49 203 7884800
357705469 120510 G Jan. 13, 2026, 1:23 p.m. OK C++20 (GCC 13-64) TESTS 49 234 6451200
357723193 toba G Jan. 13, 2026, 3:36 p.m. OK C++20 (GCC 13-64) TESTS 49 250 819200
357723082 toba G Jan. 13, 2026, 3:35 p.m. OK C++20 (GCC 13-64) TESTS 49 296 921600
357764865 Vili1234 G Jan. 13, 2026, 9:32 p.m. OK C++20 (GCC 13-64) TESTS 49 296 56012800
357653046 KangLing G Jan. 13, 2026, 4:45 a.m. OK C++20 (GCC 13-64) TESTS 49 390 4096000
357771616 LHaooo G Jan. 14, 2026, 1:31 a.m. OK C++20 (GCC 13-64) TESTS 49 406 61849600
357770358 shanyikai G Jan. 14, 2026, 12:51 a.m. OK C++20 (GCC 13-64) TESTS 49 453 0
357778151 WorldWarV G Jan. 14, 2026, 4:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 49 109 512000
357778957 WorldWarV G Jan. 14, 2026, 4:17 a.m. OK C++23 (GCC 14-64, msys2) TESTS 49 140 102400
357779357 WorldWarV G Jan. 14, 2026, 4:24 a.m. OK C++23 (GCC 14-64, msys2) TESTS 49 140 2457600
357778072 WorldWarV G Jan. 14, 2026, 4:01 a.m. OK C++23 (GCC 14-64, msys2) TESTS 49 156 512000
357783961 WorldWarV G Jan. 14, 2026, 5:35 a.m. OK C++23 (GCC 14-64, msys2) TESTS 49 171 512000
357770063 ComeAlone G Jan. 14, 2026, 12:43 a.m. OK C++23 (GCC 14-64, msys2) TESTS 49 187 2867200
357706486 enslaved G Jan. 13, 2026, 1:30 p.m. OK C++23 (GCC 14-64, msys2) TESTS 49 187 7475200
357658445 dooglius G Jan. 13, 2026, 5:56 a.m. OK C++23 (GCC 14-64, msys2) TESTS 49 218 0
357715666 lybord G Jan. 13, 2026, 2:35 p.m. OK C++23 (GCC 14-64, msys2) TESTS 49 218 102400
357754886 Bramer_x G Jan. 13, 2026, 7:12 p.m. OK C++23 (GCC 14-64, msys2) TESTS 49 218 1024000
357786248 0x3F G Jan. 14, 2026, 6:05 a.m. OK Go TESTS 49 109 3174400
357786659 0x3F G Jan. 14, 2026, 6:09 a.m. OK Go TESTS 49 109 3481600
357786014 0x3F G Jan. 14, 2026, 6:02 a.m. OK Go TESTS 49 125 4300800
357786184 0x3F G Jan. 14, 2026, 6:04 a.m. OK Go TESTS 49 156 3174400
357678509 yiren G Jan. 13, 2026, 9:36 a.m. OK Go TESTS 49 250 6246400
357677674 smilences G Jan. 13, 2026, 9:30 a.m. OK Go TESTS 49 265 5427200
357679658 yiren G Jan. 13, 2026, 9:46 a.m. OK Go TESTS 49 312 5734400
357785765 0x3F G Jan. 14, 2026, 5:59 a.m. OK Go TESTS 49 328 8294400
357785457 0x3F G Jan. 14, 2026, 5:55 a.m. OK Go TESTS 49 375 16691200
357690626 LittleGopher G Jan. 13, 2026, 11:22 a.m. OK Go TESTS 49 1187 18636800
357673954 NanDemo G Jan. 13, 2026, 8:57 a.m. OK Java 21 TESTS 49 593 2252800
357760663 cpp10 G Jan. 13, 2026, 8:16 p.m. OK Java 21 TESTS 49 609 18022400
357760752 cpp10 G Jan. 13, 2026, 8:17 p.m. OK Java 21 TESTS 49 609 19353600
357675130 NanDemo G Jan. 13, 2026, 9:08 a.m. OK Java 21 TESTS 49 671 1126400
357784941 minibin G Jan. 14, 2026, 5:48 a.m. OK Java 21 TESTS 49 1140 1331200
357758671 cpp10 G Jan. 13, 2026, 7:49 p.m. OK Java 21 TESTS 49 1250 12595200
357758383 cpp10 G Jan. 13, 2026, 7:45 p.m. OK Java 21 TESTS 49 1296 11366400
357680715 iam_bk G Jan. 13, 2026, 9:55 a.m. OK Java 21 TESTS 49 1953 1433600
357773062 MohitRajKashyap G Jan. 14, 2026, 2:16 a.m. OK Java 21 TESTS 49 2046 716800
357744807 Roy-Soumik G Jan. 13, 2026, 5:58 p.m. OK Java 8 TESTS 49 1859 3584000
357765996 arvindf232 G Jan. 13, 2026, 10:03 p.m. OK Kotlin 2.2 TESTS 49 656 24678400
357688977 Friedrich G Jan. 13, 2026, 11:08 a.m. OK PyPy 3-64 TESTS 49 421 32153600
357657991 fatalerror G Jan. 13, 2026, 5:51 a.m. OK PyPy 3-64 TESTS 49 500 34304000
357678921 Friedrich G Jan. 13, 2026, 9:40 a.m. OK PyPy 3-64 TESTS 49 687 29900800
357689541 Polynomu G Jan. 13, 2026, 11:13 a.m. OK PyPy 3-64 TESTS 49 687 31948800
357679546 yiren G Jan. 13, 2026, 9:45 a.m. OK PyPy 3-64 TESTS 49 781 27648000
357679134 yiren G Jan. 13, 2026, 9:41 a.m. OK PyPy 3-64 TESTS 49 843 27545600
357678717 yiren G Jan. 13, 2026, 9:38 a.m. OK PyPy 3-64 TESTS 49 843 27545600
357678650 yiren G Jan. 13, 2026, 9:37 a.m. OK PyPy 3-64 TESTS 49 843 27545600
357678940 yiren G Jan. 13, 2026, 9:40 a.m. OK PyPy 3-64 TESTS 49 859 27648000
357679489 yiren G Jan. 13, 2026, 9:44 a.m. OK PyPy 3-64 TESTS 49 875 27648000
357696269 bqn G Jan. 13, 2026, 12:10 p.m. OK Rust 2021 TESTS 49 531 14950400
357714797 Aizon G Jan. 13, 2026, 2:28 p.m. OK Rust 2021 TESTS 49 2015 39936000
357741202 GUAIKATTO G Jan. 13, 2026, 5:36 p.m. OK Rust 2024 TESTS 49 843 29798400

remove filters

Back to search problems