Codeforces Round 1074 (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
2185 Codeforces Round 1074 (Div. 4) FINISHED False 8100 7658723 Jan. 18, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 20407 ) D OutOfMemoryError PROGRAMMING data structures implementation math two pointers

Bessie has an array of (n) integers (a_1, a_2, \ldots, a_n). Bessie performs (m) operations on the array. The (i)-th operation sets (a_{b_i} = a_{b_i} + c_i). Unfortunately, due to rising RAM costs, Bessie's computer has limited memory, and whenever any element of the array is greater than (h), her computer crashes, and every element in the array is reset to its original value. After all operations have been performed, output the array (a). The first line of the input contains a single integer (t) ((1 \leq t \leq 10^4)) — the number of test cases. The first line of each test case contains three integers (n, m, h) ((1 \le n, m \le 2 \cdot 10^5), (1 \leq h \leq 10^9)) — the length of array (a), the number of operations performed, and the maximum value that Bessie's computer can store without crashing. The second line contains (n) integers (a_1, a_2, \ldots, a_n) ((0 \le a_i \le h)) — the array (a). The next (m) lines contain two integers (b_i, c_i) ((1 \leq b_i \leq n), (0 \leq c_i \leq 10^9)) — the operations that Bessie performs on the array. It is guaranteed that the sum of (n) and the sum of (m) over all test cases does not exceed (2 \cdot 10^5). For each test case, output the array (a) after all operations have been performed. For the first test case, the array (a) is changed as follows: Before all operations, (a = 1, 2, 1). After the first operation, (a = 5, 2, 1). After the second operation, (a = 5, 6, 1), but since (6 > h), the computer crashes, and (a = 1, 2, 1). After the third operation, (a = 1, 2, 4). After the fourth operation, (a = 1, 2, 4). For the third test case, each operation causes the computer to crash, so (a = 1, 0, 0, 0).

Tutorials

Codeforces Round 1074 (Div. 4) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
358680128 Arise_0111 D Jan. 19, 2026, 5:03 a.m. OK C++17 (GCC 7-32) TESTS 9 125 102400
358641570 mpavansrikar2007 D Jan. 18, 2026, 5:26 p.m. OK C++17 (GCC 7-32) TESTS 9 140 102400
358632874 kunalchandra2008 D Jan. 18, 2026, 4:46 p.m. OK C++17 (GCC 7-32) TESTS 9 140 819200
358678241 Yuvraj-Soni D Jan. 19, 2026, 4:39 a.m. OK C++17 (GCC 7-32) TESTS 9 156 0
358662376 Road_To_The_Void D Jan. 18, 2026, 10:19 p.m. OK C++17 (GCC 7-32) TESTS 9 156 0
358660692 Nicolo_010 D Jan. 18, 2026, 9:30 p.m. OK C++17 (GCC 7-32) TESTS 9 156 0
358629932 AnshGupta06 D Jan. 18, 2026, 4:42 p.m. OK C++17 (GCC 7-32) TESTS 9 156 0
358636820 vkisgoat D Jan. 18, 2026, 4:56 p.m. OK C++17 (GCC 7-32) TESTS 9 156 0
358685213 rahulraman2603 D Jan. 19, 2026, 5:55 a.m. OK C++17 (GCC 7-32) TESTS 9 156 0
358681193 lifestooeasy78 D Jan. 19, 2026, 5:14 a.m. OK C++17 (GCC 7-32) TESTS 9 156 0
358644609 SHaF3Y D Jan. 18, 2026, 5:49 p.m. OK C++20 (GCC 13-64) TESTS 9 125 0
358682580 i_anmolagarwal D Jan. 19, 2026, 5:29 a.m. OK C++20 (GCC 13-64) TESTS 9 125 0
358656999 nadya_adel D Jan. 18, 2026, 8:14 p.m. OK C++20 (GCC 13-64) TESTS 9 125 0
358644680 stash D Jan. 18, 2026, 5:49 p.m. OK C++20 (GCC 13-64) TESTS 9 125 0
358643301 hnuahe_Hhh D Jan. 18, 2026, 5:39 p.m. OK C++20 (GCC 13-64) TESTS 9 125 0
358643285 Toninhorf D Jan. 18, 2026, 5:39 p.m. OK C++20 (GCC 13-64) TESTS 9 125 102400
358670940 _MS_1422 D Jan. 19, 2026, 2:47 a.m. OK C++20 (GCC 13-64) TESTS 9 125 102400
358661199 LeanCoder D Jan. 18, 2026, 9:44 p.m. OK C++20 (GCC 13-64) TESTS 9 125 102400
358653923 NomNomFull D Jan. 18, 2026, 7:26 p.m. OK C++20 (GCC 13-64) TESTS 9 125 102400
358644455 akshat.jaipuriar D Jan. 18, 2026, 5:48 p.m. OK C++20 (GCC 13-64) TESTS 9 125 102400
358682068 ahmedrizk D Jan. 19, 2026, 5:23 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 109 0
358652223 Shihiro D Jan. 18, 2026, 7:04 p.m. OK C++23 (GCC 14-64, msys2) TESTS 9 125 0
358680994 smaitra006 D Jan. 19, 2026, 5:12 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 125 0
358676639 songzc D Jan. 19, 2026, 4:14 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 125 0
358669789 mengxxyy D Jan. 19, 2026, 2:28 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 125 0
358664989 hadyr D Jan. 19, 2026, 12:08 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 125 0
358660206 anonymous.expertaj22 D Jan. 18, 2026, 9:18 p.m. OK C++23 (GCC 14-64, msys2) TESTS 9 125 0
358657917 Michi_Numberz D Jan. 18, 2026, 8:31 p.m. OK C++23 (GCC 14-64, msys2) TESTS 9 125 0
358654464 FireDragon D Jan. 18, 2026, 7:34 p.m. OK C++23 (GCC 14-64, msys2) TESTS 9 125 0
358653525 darpanPorwal D Jan. 18, 2026, 7:21 p.m. OK C++23 (GCC 14-64, msys2) TESTS 9 125 0
358632509 hollow_knight_27 D Jan. 18, 2026, 4:46 p.m. OK C# 8 TESTS 9 312 33792000
358634480 Basic_Go D Jan. 18, 2026, 4:48 p.m. OK D TESTS 9 328 15667200
358659374 AntonKorch D Jan. 18, 2026, 9 p.m. OK F# 9 TESTS 9 281 44748800
358633172 matrix081621 D Jan. 18, 2026, 4:47 p.m. OK GNU C11 TESTS 9 875 2457600
358653566 Coderhacks16 D Jan. 18, 2026, 7:22 p.m. OK GNU C11 TESTS 9 921 3276800
358654615 CptPrice1870 D Jan. 18, 2026, 7:37 p.m. OK GNU C11 TESTS 9 953 2457600
358631013 brkrishna_2105_ D Jan. 18, 2026, 4:44 p.m. OK GNU C11 TESTS 9 953 2457600
358645153 nashedi1212 D Jan. 18, 2026, 5:53 p.m. OK GNU C11 TESTS 9 953 3276800
358631786 Nani_06 D Jan. 18, 2026, 4:45 p.m. OK GNU C11 TESTS 9 953 3993600
358633670 sagankrishnagupta D Jan. 18, 2026, 4:47 p.m. OK GNU C11 TESTS 9 953 4096000
358633887 kiran1929 D Jan. 18, 2026, 4:48 p.m. OK GNU C11 TESTS 9 953 4710400
358629032 Cessdav D Jan. 18, 2026, 4:41 p.m. OK GNU C11 TESTS 9 968 2355200
358654500 Piyush.1409 D Jan. 18, 2026, 7:35 p.m. OK GNU C11 TESTS 9 968 2662400
358659583 ko0g D Jan. 18, 2026, 9:04 p.m. OK Go TESTS 9 296 10956800
358641391 eval_apply D Jan. 18, 2026, 5:25 p.m. OK Haskell TESTS 9 625 80896000
358632725 ahmeddhibi D Jan. 18, 2026, 4:46 p.m. OK Java 21 TESTS 9 218 3584000
358633767 shadowhunter09 D Jan. 18, 2026, 4:47 p.m. OK Java 21 TESTS 9 218 4505600
358640493 Pamarthi123 D Jan. 18, 2026, 5:19 p.m. OK Java 21 TESTS 9 234 3788800
358634990 HarshitYash D Jan. 18, 2026, 4:49 p.m. OK Java 21 TESTS 9 250 409600
358635074 mishraaman7417 D Jan. 18, 2026, 4:49 p.m. OK Java 21 TESTS 9 250 819200
358630949 suhani006 D Jan. 18, 2026, 4:44 p.m. OK Java 21 TESTS 9 250 4300800
358631661 Vedant87 D Jan. 18, 2026, 4:45 p.m. OK Java 21 TESTS 9 250 4403200
358637338 nishtha0507 D Jan. 18, 2026, 4:59 p.m. OK Java 21 TESTS 9 281 3891200
358651510 hegdearu D Jan. 18, 2026, 6:55 p.m. OK Java 21 TESTS 9 312 614400
358649261 pushkar_shinde D Jan. 18, 2026, 6:30 p.m. OK Java 21 TESTS 9 359 4915200
358682852 Hari_1010 D Jan. 19, 2026, 5:31 a.m. OK Java 8 TESTS 9 187 8806400
358631266 vaishnawie D Jan. 18, 2026, 4:44 p.m. OK Java 8 TESTS 9 265 13824000
358655177 Prime_Geek D Jan. 18, 2026, 7:46 p.m. OK Java 8 TESTS 9 281 13926400
358659071 abhayrajnegi0416 D Jan. 18, 2026, 8:54 p.m. OK Java 8 TESTS 9 328 12492800
358676557 _sitesh_kumar D Jan. 19, 2026, 4:13 a.m. OK Java 8 TESTS 9 375 16896000
358661782 debanjan14920 D Jan. 18, 2026, 10 p.m. OK Java 8 TESTS 9 875 8499200
358653292 Vishalll_ D Jan. 18, 2026, 7:18 p.m. OK Java 8 TESTS 9 906 10035200
358633294 AnkushSil D Jan. 18, 2026, 4:47 p.m. OK Java 8 TESTS 9 953 4812800
358631198 NitheeshV D Jan. 18, 2026, 4:44 p.m. OK Java 8 TESTS 9 953 8499200
358634491 hvss24 D Jan. 18, 2026, 4:48 p.m. OK Java 8 TESTS 9 1031 0
358667725 binhuq D Jan. 19, 2026, 1:41 a.m. OK Kotlin 2.2 TESTS 9 531 21401600
358667834 sparadigm D Jan. 19, 2026, 1:44 a.m. OK Kotlin 2.2 TESTS 9 671 17920000
358647071 anyoneee D Jan. 18, 2026, 6:10 p.m. OK Node.js TESTS 9 437 76595200
358638500 nadiraaraa D Jan. 18, 2026, 5:06 p.m. OK PyPy 3 TESTS 9 875 20684800
358677778 Itachi42O D Jan. 19, 2026, 4:32 a.m. OK PyPy 3 TESTS 9 1203 22220800
358669411 dhanushkotte2 D Jan. 19, 2026, 2:20 a.m. OK PyPy 3 TESTS 9 1312 20684800
358680917 javoh1964 D Jan. 19, 2026, 5:11 a.m. OK PyPy 3 TESTS 9 1343 20684800
358663450 xashh D Jan. 18, 2026, 11 p.m. OK PyPy 3 TESTS 9 1390 19148800
358628789 MazenCh D Jan. 18, 2026, 4:41 p.m. OK PyPy 3 TESTS 9 1390 20684800
358634883 shrinil D Jan. 18, 2026, 4:49 p.m. OK PyPy 3 TESTS 9 1515 22835200
358631156 Utsav-pal D Jan. 18, 2026, 4:44 p.m. OK PyPy 3 TESTS 9 1546 22323200
358642051 gardengnome D Jan. 18, 2026, 5:30 p.m. OK PyPy 3-64 TESTS 9 171 28057600
358653290 isanz D Jan. 18, 2026, 7:18 p.m. OK PyPy 3-64 TESTS 9 187 27033600
358652844 shashankvinakota25 D Jan. 18, 2026, 7:12 p.m. OK PyPy 3-64 TESTS 9 187 27136000
358685048 adamlip D Jan. 19, 2026, 5:53 a.m. OK PyPy 3-64 TESTS 9 203 27033600
358662165 InsanityLemon D Jan. 18, 2026, 10:12 p.m. OK PyPy 3-64 TESTS 9 203 30720000
358666827 fatalerror D Jan. 19, 2026, 1:16 a.m. OK PyPy 3-64 TESTS 9 218 26726400
358657566 yossrammar D Jan. 18, 2026, 8:24 p.m. OK PyPy 3-64 TESTS 9 218 27033600
358635636 Pheww_coder D Jan. 18, 2026, 4:49 p.m. OK PyPy 3-64 TESTS 9 218 28876800
358655957 Mostov D Jan. 18, 2026, 7:57 p.m. OK PyPy 3-64 TESTS 9 218 30105600
358642667 OAY71011 D Jan. 18, 2026, 5:34 p.m. OK PyPy 3-64 TESTS 9 218 30105600
358665463 Vishesh.369 D Jan. 19, 2026, 12:26 a.m. OK Python 2 TESTS 9 531 40960000
358638005 ADHITHYAN_M06 D Jan. 18, 2026, 5:03 p.m. OK Python 3 TESTS 9 296 69222400
358656438 kaushik.atla D Jan. 18, 2026, 8:05 p.m. OK Python 3 TESTS 9 312 29696000
358631603 -0.10 D Jan. 18, 2026, 4:45 p.m. OK Python 3 TESTS 9 328 67072000
358630613 Iceylx D Jan. 18, 2026, 4:43 p.m. OK Python 3 TESTS 9 406 71577600
358646100 TwinkleAI D Jan. 18, 2026, 6:01 p.m. OK Python 3 TESTS 9 468 27545600
358646149 TwinkleAI D Jan. 18, 2026, 6:01 p.m. OK Python 3 TESTS 9 468 27648000
358646822 Etrain D Jan. 18, 2026, 6:07 p.m. OK Python 3 TESTS 9 515 45465600
358631448 kireetir2005 D Jan. 18, 2026, 4:44 p.m. OK Python 3 TESTS 9 546 27443200
358632713 ydeepanshu2310 D Jan. 18, 2026, 4:46 p.m. OK Python 3 TESTS 9 546 35430400
358646209 TwinkleAI D Jan. 18, 2026, 6:02 p.m. OK Python 3 TESTS 9 562 26726400
358667350 Spheniscine D Jan. 19, 2026, 1:31 a.m. OK Rust 2021 TESTS 9 156 3993600
358628705 Tantellam D Jan. 18, 2026, 4:41 p.m. OK Rust 2024 TESTS 9 109 2867200

remove filters

Back to search problems