Codeforces Round 1098 (Div. 2)

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
2228 Codeforces Round 1098 (Div. 2) FINISHED False 8100 1437887 May 16, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 249 ) E2 Amanojaku and Sequence (Hard Version) PROGRAMMING combinatorics data structures implementation math

This is the hard version of the problem. The difference between the versions is that in this version, (1\le q \le 3\cdot 10^5) and (1\le\mathrm{op}\le2). You can hack only if you solved all versions of this problem. For a sequence (s), let (|s|) denote its length. For a non-negative integer sequence (c), define (f(c)) as the sum of the squares of its prefix sums: () f(c)=\sum_{i=1}^{|c|}\left(\sum_{j=1}^{i} c_j\right)^2. () Now define (g(b,m)) as follows. Let (b) be an integer sequence such that (b_i\ge -1) for every (i), and let (m) be a non-negative integer. A non-negative integer sequence (c) is called valid for ((b,m)) if all of the following conditions hold: (|c|=|b|); (\sum_{i=1}^{|c|} c_i=m); for every (1\le i\le |b|), if (b_i\ge 0), then (c_i=b_i); otherwise, if (b_i=-1), then (c_i) may be any non-negative integer. The value (g(b,m)) is defined as the sum of (f(c)) over all valid sequences (c) for ((b,m)). If there is no such sequence, then (g(b,m)=0). You are given an array (a) of length (n), where (a_i\ge -1), and (q) queries of the following two types: Given two integers (p) and (v), set (a_p) to (v). Given three integers (l), (r), and (m), compute (g(a_l,a_{l+1},\ldots,a_r,m)) modulo (998\,244\,353), where (a_l,a_{l+1},\ldots,a_r) denotes the subarray(^{\text{∗}}) of (a) from position (l) to position (r). (^{\text{∗}})An array (a) is a subarray of an array (b) if (a) can be obtained from (b) by the deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. For each test case, the first line contains two integer

Tutorials

Codeforces Round 1098 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
374883798 s-ahmad461 E2 May 17, 2026, 1:46 a.m. OK C++17 (GCC 7-32) TESTS 39 1156 86528000
374847826 yash_071 E2 May 16, 2026, 4:37 p.m. OK C++17 (GCC 7-32) TESTS 39 1312 102297600
374901297 acmjohn E2 May 17, 2026, 5:32 a.m. OK C++17 (GCC 7-32) TESTS 39 1312 109158400
374853566 Manan_1729 E2 May 16, 2026, 4:47 p.m. OK C++17 (GCC 7-32) TESTS 39 1328 106291200
374847131 DocFlex E2 May 16, 2026, 4:35 p.m. OK C++17 (GCC 7-32) TESTS 39 1359 117145600
374849125 fakeapple E2 May 16, 2026, 4:39 p.m. OK C++17 (GCC 7-32) TESTS 39 1500 75878400
374853718 I_mad_scientist E2 May 16, 2026, 4:47 p.m. OK C++17 (GCC 7-32) TESTS 39 1578 43008000
374848996 sin_ghbibhu E2 May 16, 2026, 4:39 p.m. OK C++17 (GCC 7-32) TESTS 39 1609 109056000
374887520 hindj E2 May 17, 2026, 3:02 a.m. OK C++17 (GCC 7-32) TESTS 39 1640 89395200
374848576 harsh1302 E2 May 16, 2026, 4:38 p.m. OK C++17 (GCC 7-32) TESTS 39 2156 97075200
374883400 serein514 E2 May 17, 2026, 1:36 a.m. OK C++20 (GCC 13-64) TESTS 39 609 78643200
374846712 wuyuetong E2 May 16, 2026, 4:34 p.m. OK C++20 (GCC 13-64) TESTS 39 640 121139200
374887326 AILevel E2 May 17, 2026, 2:59 a.m. OK C++20 (GCC 13-64) TESTS 39 656 117248000
374851827 isgisg E2 May 16, 2026, 4:44 p.m. OK C++20 (GCC 13-64) TESTS 39 671 87859200
374848277 Preet_Mehta E2 May 16, 2026, 4:37 p.m. OK C++20 (GCC 13-64) TESTS 39 765 106393600
374873808 Roc_ E2 May 16, 2026, 8:53 p.m. OK C++20 (GCC 13-64) TESTS 39 781 123494400
374850005 thanhbinh77810714 E2 May 16, 2026, 4:41 p.m. OK C++20 (GCC 13-64) TESTS 39 796 117248000
374853124 cipher404 E2 May 16, 2026, 4:46 p.m. OK C++20 (GCC 13-64) TESTS 39 812 194150400
374867445 noya2 E2 May 16, 2026, 7:26 p.m. OK C++20 (GCC 13-64) TESTS 39 875 113254400
374882471 gerkghdri E2 May 17, 2026, 1:15 a.m. OK C++20 (GCC 13-64) TESTS 39 1093 105164800
374846626 maspy E2 May 16, 2026, 4:34 p.m. OK C++23 (GCC 14-64, msys2) TESTS 39 531 92364800
374870256 CatalanConvolution E2 May 16, 2026, 7:59 p.m. OK C++23 (GCC 14-64, msys2) TESTS 39 546 101785600
374878863 haojiandan E2 May 16, 2026, 10:53 p.m. OK C++23 (GCC 14-64, msys2) TESTS 39 656 95232000
374849886 Kolanda E2 May 16, 2026, 4:40 p.m. OK C++23 (GCC 14-64, msys2) TESTS 39 671 58368000
374881797 Nachia E2 May 17, 2026, 12:29 a.m. OK C++23 (GCC 14-64, msys2) TESTS 39 671 106598400
374889813 y_himanshu E2 May 17, 2026, 3:40 a.m. OK C++23 (GCC 14-64, msys2) TESTS 39 687 92979200
374853619 wulukana E2 May 16, 2026, 4:47 p.m. OK C++23 (GCC 14-64, msys2) TESTS 39 687 99635200
374855188 ChatGPT-5.5 E2 May 16, 2026, 4:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 39 687 117350400
374866149 nice333 E2 May 16, 2026, 7:16 p.m. OK C++23 (GCC 14-64, msys2) TESTS 39 703 67993600
374853491 abi_47 E2 May 16, 2026, 4:47 p.m. OK C++23 (GCC 14-64, msys2) TESTS 39 703 111513600
374846473 Meren4 E2 May 16, 2026, 4:34 p.m. OK GNU C11 TESTS 39 703 63078400
374851815 matheussricardoo E2 May 16, 2026, 4:44 p.m. OK Go TESTS 39 1062 124313600
374900644 MBBN E2 May 17, 2026, 5:25 a.m. OK Java 21 TESTS 39 2156 158310400
374850471 sudeepreddy7893 E2 May 16, 2026, 4:42 p.m. OK Java 21 TESTS 39 2218 184934400
374847331 PotatoCoder_ E2 May 16, 2026, 4:36 p.m. OK Node.js TESTS 39 3328 116224000
374846064 toam E2 May 16, 2026, 4:33 p.m. OK PyPy 3-64 TESTS 39 3812 352256000
374864758 A_G E2 May 16, 2026, 7:04 p.m. OK Rust 2024 TESTS 39 1062 130560000

remove filters

Back to search problems