Educational Codeforces Round 181 (Rated for 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
2125 Educational Codeforces Round 181 (Rated for Div. 2) FINISHED False 7200 23210723 July 22, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1404 ) E Sets of Complementary Sums PROGRAMMING combinatorics dp math two pointers

We call a set of integers (Q) a set of complementary sums if it can be obtained through the following actions: choose an array (a) consisting of (m) positive integers ((m) is any positive integer); calculate the sum (s) of all elements in the array (a); for each element (a_{i}) in the array, add the number (s - a_{i}) to the set, more formally the set (Q = \{s - a_{i}\;|\; 1 \le i \le m\}). Note that (Q) is not a multiset, meaning each number in it is unique. For example, if the array (a = 1, 3, 3, 7) was chosen, then (s = 14) and (Q = \{7, 11, 13\}). Your task is to count the number of distinct sets of complementary sums for which the following holds: the set contains exactly (n) elements; each element of the set is an integer from (1) to (x). Two sets are considered different if there exists an element in the first set that is not included in the second set. Since the answer can be huge, output it modulo (998\,244\,353). Each test consists of several test cases. The first line contains a single integer (t) ((1 \le t \le 10^{4})) — the number of test cases. The description of the test cases follows. The only line of each test case contains two integers (n) and (x) ((1 \le n, x \le 2 \cdot 10^{5})). Additional constraints on the input data: the sum of (n) across all test cases does not exceed (2 \cdot 10^{5}); the sum of (x) across all test cases does not exceed (2 \cdot 10^{5}). For each test case, output a single integer — the answer to the problem modulo (998\,244\,353). For the first test case, there are exactly (7) suitable sets: ()\{1\}, \{2\}, \{3\}, \{4\}, \{5\}, \{6\}, \{7\}() For the second test case, there are (10) suitable sets: ()\{1, 2\}, \{1, 3\}, \{1, 4\}, \{1, 5\}, \{2, 3\}, \{2, 4\}, \{2, 5\}, \{3, 4\}, \{3, 5\}, \{4, 5\}()

Tutorials

Educational Codeforces Round 181 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
330407547 -firefly- E July 22, 2025, 5:04 p.m. OK C# 13 TESTS 22 531 614400
330448574 ghc7hHx E July 23, 2025, 2:46 a.m. OK C++17 (GCC 7-32) TESTS 22 61 102400
330455088 -Guts E July 23, 2025, 3:57 a.m. OK C++17 (GCC 7-32) TESTS 22 61 819200
330443566 Tomato_Cultivator E July 23, 2025, 1:48 a.m. OK C++17 (GCC 7-32) TESTS 22 61 1126400
330406335 Abhinav_2004 E July 22, 2025, 4:55 p.m. OK C++17 (GCC 7-32) TESTS 22 62 0
330434464 forest E July 22, 2025, 10:57 p.m. OK C++17 (GCC 7-32) TESTS 22 62 102400
330418120 chenwenmo E July 22, 2025, 6:36 p.m. OK C++17 (GCC 7-32) TESTS 22 77 819200
330425355 cbdsopa E July 22, 2025, 8:02 p.m. OK C++17 (GCC 7-32) TESTS 22 124 819200
330405569 chien342006 E July 22, 2025, 4:50 p.m. OK C++17 (GCC 7-32) TESTS 22 140 31129600
330414562 Razvan_Rotaru E July 22, 2025, 6:03 p.m. OK C++17 (GCC 7-32) TESTS 22 155 102400
330404734 catching_cheats E July 22, 2025, 4:45 p.m. OK C++17 (GCC 7-32) TESTS 22 155 102400
330435526 balakrishnan E July 22, 2025, 11:33 p.m. OK C++20 (GCC 13-64) TESTS 22 61 0
330453775 Ichinoseyang E July 23, 2025, 3:42 a.m. OK C++20 (GCC 13-64) TESTS 22 62 102400
330410078 fanhuaxingyu E July 22, 2025, 5:25 p.m. OK C++20 (GCC 13-64) TESTS 22 62 102400
330408294 fanhuaxingyu E July 22, 2025, 5:10 p.m. OK C++20 (GCC 13-64) TESTS 22 62 102400
330405700 doreen129 E July 22, 2025, 4:51 p.m. OK C++20 (GCC 13-64) TESTS 22 62 102400
330403579 gigachau E July 22, 2025, 4:39 p.m. OK C++20 (GCC 13-64) TESTS 22 62 102400
330395759 AlgoPilot E July 22, 2025, 4:17 p.m. OK C++20 (GCC 13-64) TESTS 22 62 102400
330400309 Khalid_Kamal_ E July 22, 2025, 4:29 p.m. OK C++20 (GCC 13-64) TESTS 22 62 921600
330394851 ShmilyTY E July 22, 2025, 4:14 p.m. OK C++20 (GCC 13-64) TESTS 22 62 2457600
330396363 RegenTrophen E July 22, 2025, 4:18 p.m. OK C++20 (GCC 13-64) TESTS 22 62 16076800
330421974 Justinshao E July 22, 2025, 7:20 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 46 0
330417778 Rensuke_Kunigami E July 22, 2025, 6:33 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 61 0
330427701 ygy0 E July 22, 2025, 8:35 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 61 102400
330450853 Bejoker E July 23, 2025, 3:10 a.m. OK C++23 (GCC 14-64, msys2) TESTS 22 61 819200
330414115 hhhhyf E July 22, 2025, 5:59 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 62 0
330407758 Ausp3x E July 22, 2025, 5:06 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 62 0
330404078 za0271497 E July 22, 2025, 4:41 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 62 0
330402214 3a51 E July 22, 2025, 4:33 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 62 0
330464160 CP_GOD_9 E July 23, 2025, 5:46 a.m. OK C++23 (GCC 14-64, msys2) TESTS 22 62 102400
330456164 MoonLe E July 23, 2025, 4:10 a.m. OK C++23 (GCC 14-64, msys2) TESTS 22 62 102400
330396688 Harshaditya_Sharma E July 22, 2025, 4:19 p.m. OK Go TESTS 22 203 82841600
330406280 lupunish E July 22, 2025, 4:55 p.m. OK Java 21 TESTS 22 1249 1126400
330393954 saicharangopisetty23 E July 22, 2025, 4:12 p.m. OK Java 8 TESTS 22 312 0
330404488 bcollet E July 22, 2025, 4:44 p.m. OK PyPy 3-64 TESTS 22 155 3788800
330452472 smilences E July 23, 2025, 3:27 a.m. OK PyPy 3-64 TESTS 22 156 4710400
330401721 akhil2811 E July 22, 2025, 4:32 p.m. OK PyPy 3-64 TESTS 22 171 6348800
330403422 FlavioDrogo E July 22, 2025, 4:38 p.m. OK PyPy 3-64 TESTS 22 186 6348800
330461418 IcyGirl E July 23, 2025, 5:16 a.m. OK PyPy 3-64 TESTS 22 202 7782400
330418023 Jien E July 22, 2025, 6:35 p.m. OK PyPy 3-64 TESTS 22 249 24473600
330404705 dalgu_py E July 22, 2025, 4:45 p.m. OK PyPy 3-64 TESTS 22 265 24473600
330394427 DeadRhino E July 22, 2025, 4:13 p.m. OK PyPy 3-64 TESTS 22 671 196608000
330409029 Duv E July 22, 2025, 5:16 p.m. OK PyPy 3-64 TESTS 22 1030 46796800
330458248 IcyGirl E July 23, 2025, 4:38 a.m. OK PyPy 3-64 TESTS 22 1499 8396800
330459637 Laceprndpm E July 23, 2025, 4:56 a.m. OK Rust 2021 TESTS 22 77 0
330411874 gupta_03 E July 22, 2025, 5:40 p.m. OK Rust 2021 TESTS 22 656 503910400

remove filters

Back to search problems