Kotlin Heroes: Episode 14

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
2199 Kotlin Heroes: Episode 14 FINISHED False 9000 3943523 March 2, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 140 ) F Self-Produced Sequences PROGRAMMING *special combinatorics math

Let's call an integer sequence self-produced if for every (i) ((1 \le i \le n)) at least one of the following conditions holds: (a_i) is equal to the sum of the elements on the left (i. e. (a_i = \displaystyle\sum\limits_{j = 1}^{i - 1} a_j)); (a_i) is equal to the sum of the elements on the right (i. e. (a_i = \displaystyle\sum\limits_{j = i + 1}^{n} a_j)). Note that (0) at the beginning/end of the sequence is also considered valid. You are given an integer array (a) of size (n). Your task is to calculate the number of self-produced subsequences of the array (a). Since the answer might be large, print it modulo (998244353). Two subsequences are different if the indices of chosen elements are different. The first line contains a single integer (t) ((1 \le t \le 10^4)) — the number of test cases. The first line of each test case contains a single integer (n) ((1 \le n \le 2 \cdot 10^5)). The second line contains (n) integers (a_1, a_2, \dots, a_n) ((0 \le a_i \le 10^9)). Additional constraint on the input: the sum of (n) over all test cases doesn't exceed (2 \cdot 10^5). For each test case, print a single integer — the number of self-produced subsequences of the array (a) taken modulo (998244353).

Tutorials

151783

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
365116428 yatuoximeng F March 2, 2026, 4:21 p.m. OK Kotlin 1.7 TESTS 16 328 51200000
365114255 Sumit_Mahajan F March 2, 2026, 4:04 p.m. OK Kotlin 1.7 TESTS 16 359 47718400
365106961 potato167 F March 2, 2026, 3:12 p.m. OK Kotlin 1.7 TESTS 16 390 50073600
365110901 khba F March 2, 2026, 3:39 p.m. OK Kotlin 1.7 TESTS 16 406 103731200
365117364 marajul.haque.cu.bd F March 2, 2026, 4:29 p.m. OK Kotlin 1.7 TESTS 16 437 78643200
365111498 MagnusCarlsen321 F March 2, 2026, 3:43 p.m. OK Kotlin 1.7 TESTS 16 453 91033600
365116415 kriradhaks F March 2, 2026, 4:21 p.m. OK Kotlin 1.7 TESTS 16 484 19763200
365116000 doccocaubai F March 2, 2026, 4:18 p.m. OK Kotlin 1.7 TESTS 16 531 73216000
365110100 ttamx F March 2, 2026, 3:33 p.m. OK Kotlin 1.7 TESTS 16 546 97996800
365109556 tabr F March 2, 2026, 3:29 p.m. OK Kotlin 1.7 TESTS 16 546 98304000
365114918 ktobarsuk F March 2, 2026, 4:09 p.m. OK Kotlin 1.9 TESTS 16 296 16998400
365111957 p0tato F March 2, 2026, 3:46 p.m. OK Kotlin 1.9 TESTS 16 312 0
365111881 Darren0724 F March 2, 2026, 3:46 p.m. OK Kotlin 1.9 TESTS 16 343 17305600
365116539 hot F March 2, 2026, 4:22 p.m. OK Kotlin 1.9 TESTS 16 343 20582400
365107379 BucketPotato F March 2, 2026, 3:15 p.m. OK Kotlin 1.9 TESTS 16 359 16179200
365119281 BERNARB.01 F March 2, 2026, 4:44 p.m. OK Kotlin 1.9 TESTS 16 359 16793600
365110275 __jk__ F March 2, 2026, 3:34 p.m. OK Kotlin 1.9 TESTS 16 375 16691200
365113127 irmuun F March 2, 2026, 3:55 p.m. OK Kotlin 1.9 TESTS 16 375 17920000
365113510 wu_qing F March 2, 2026, 3:58 p.m. OK Kotlin 1.9 TESTS 16 406 26726400
365111884 yudedako F March 2, 2026, 3:46 p.m. OK Kotlin 1.9 TESTS 16 500 18022400
365112407 Joskmo F March 2, 2026, 3:49 p.m. OK Kotlin 2.2 TESTS 16 156 23961600
365121820 xiaozhangup F March 2, 2026, 5:03 p.m. OK Kotlin 2.2 TESTS 16 187 29286400
365117078 nuip F March 2, 2026, 4:27 p.m. OK Kotlin 2.2 TESTS 16 187 31232000
365116861 E49869826 F March 2, 2026, 4:25 p.m. OK Kotlin 2.2 TESTS 16 203 4812800
365113310 PelicanPilot F March 2, 2026, 3:56 p.m. OK Kotlin 2.2 TESTS 16 218 25497600
365115218 ankitkumar1234__ F March 2, 2026, 4:12 p.m. OK Kotlin 2.2 TESTS 16 218 30924800
365162496 thanhnguyxn07 F March 3, 2026, 2:52 a.m. OK Kotlin 2.2 TESTS 16 218 31027200
365119809 TesLaNot F March 2, 2026, 4:48 p.m. OK Kotlin 2.2 TESTS 16 234 25497600
365162491 Stevekotlarz F March 3, 2026, 2:52 a.m. OK Kotlin 2.2 TESTS 16 281 30003200
365119324 AHOIwhker F March 2, 2026, 4:44 p.m. OK Kotlin 2.2 TESTS 16 281 39833600

remove filters

Back to search problems