Hello 2026

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
2183 Hello 2026 FINISHED False 10800 8609123 Jan. 7, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 2827 ) E LCM is Legendary Counting Master PROGRAMMING dp math number theory

You are given a sequence (a) of length (n) and a positive integer (m). Each element of (a) is an integer in the range (0, m). A sequence (a) is considered good if and only if the following two conditions hold: (a_1<a_2<a_3<\ldots<a_n), and (\frac{1}{\operatorname{lcm}(a_1,a_2)}+\frac{1}{\operatorname{lcm}(a_2,a_3)}+\ldots+\frac{1}{\operatorname{lcm}(a_{n-1},a_n)}+\color{red}{\frac{1}{\operatorname{lcm}(a_n,a_1)}}\ge1).(^{\text{∗}}) You need to replace all zeros in (a) with integers from the range (1, m). Calculate the number of different ways to replace the zeros such that the resulting sequence (a) is good . Print the answer modulo (998\,244\,353). (^{\text{∗}})The Least common multiple ((\operatorname{lcm})) of two positive integers is the smallest positive integer that is a multiple of both. For example, (\operatorname{lcm}(2,3)=6, \operatorname{lcm}(4,6)=12). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 1000)). The description of the test cases follows. The first line of each test case contains two integers (n) and (m) ((2 \le n\le m \le 3000)). The second line of each test case contains (n) integers (a_1, a_2, \ldots, a_n) ((0 \le a_i \le m)). It is guaranteed that the sum of (m) over all test cases does not exceed (3000). For each test case, output a single integer — the number of ways to complete the sequence so that it becomes good, modulo (998\,244\,353). In the first test case, there are (2) ways to replace the zeros such that the sequence becomes good: (1, 2, 3, 6): The sum is (\frac{1}{\operatorname{lcm}(1, 2)} + \frac{1}{\operatorname{lcm}(2, 3)} + \frac{1}{\operatorname{lcm}(3, 6)} + \frac{1}{\operatorname{lcm}(6, 1)} = \frac{1}{2} + \frac{1}{6} + \frac{1}{6} + \frac{1}{6} = 1). (1, 2, 4, 6): The sum is $$$\frac{1}{\operatorname{lcm}(1, 2)} + \frac{1}{

Tutorials

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
356896228 lyc2049 E Jan. 8, 2026, 3:23 a.m. OK C++17 (GCC 7-32) TESTS 29 93 102400
356865079 Lawali E Jan. 7, 2026, 5:31 p.m. OK C++17 (GCC 7-32) TESTS 29 93 102400
356862633 wjhhandle E Jan. 7, 2026, 5:25 p.m. OK C++17 (GCC 7-32) TESTS 29 93 102400
356854681 pandarabox E Jan. 7, 2026, 5:01 p.m. OK C++17 (GCC 7-32) TESTS 29 93 1331200
356906371 heavy_alice E Jan. 8, 2026, 5:42 a.m. OK C++17 (GCC 7-32) TESTS 29 109 102400
356859951 Mario. E Jan. 7, 2026, 5:16 p.m. OK C++17 (GCC 7-32) TESTS 29 109 102400
356855647 Kavyanshkrishan01 E Jan. 7, 2026, 5:04 p.m. OK C++17 (GCC 7-32) TESTS 29 109 102400
356852410 temporary1 E Jan. 7, 2026, 4:54 p.m. OK C++17 (GCC 7-32) TESTS 29 109 36249600
356852159 masa.dobric E Jan. 7, 2026, 4:54 p.m. OK C++17 (GCC 7-32) TESTS 29 109 36249600
356854715 al3xstr33t E Jan. 7, 2026, 5:01 p.m. OK C++17 (GCC 7-32) TESTS 29 109 52428800
356866284 lunarift E Jan. 7, 2026, 5:34 p.m. OK C++20 (GCC 13-64) TESTS 29 62 102400
356864814 DreamConverge E Jan. 7, 2026, 5:31 p.m. OK C++20 (GCC 13-64) TESTS 29 62 102400
356898104 thuhabong E Jan. 8, 2026, 3:53 a.m. OK C++20 (GCC 13-64) TESTS 29 78 102400
356892063 lhy123 E Jan. 8, 2026, 2:07 a.m. OK C++20 (GCC 13-64) TESTS 29 78 102400
356890267 Saquariu E Jan. 8, 2026, 1:20 a.m. OK C++20 (GCC 13-64) TESTS 29 78 102400
356857002 Desh01 E Jan. 7, 2026, 5:08 p.m. OK C++20 (GCC 13-64) TESTS 29 78 102400
356851667 1234567st E Jan. 7, 2026, 4:52 p.m. OK C++20 (GCC 13-64) TESTS 29 78 307200
356853529 i-VVin E Jan. 7, 2026, 4:58 p.m. OK C++20 (GCC 13-64) TESTS 29 93 0
356864571 Hymnic E Jan. 7, 2026, 5:30 p.m. OK C++20 (GCC 13-64) TESTS 29 93 102400
356864257 Sachchit E Jan. 7, 2026, 5:29 p.m. OK C++20 (GCC 13-64) TESTS 29 93 102400
356878342 igor99972 E Jan. 7, 2026, 8:02 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 62 102400
356849945 SorahISA E Jan. 7, 2026, 4:47 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 62 102400
356892385 bonopo E Jan. 8, 2026, 2:14 a.m. OK C++23 (GCC 14-64, msys2) TESTS 29 62 204800
356880482 igor99972 E Jan. 7, 2026, 8:36 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 62 204800
356879509 igor99972 E Jan. 7, 2026, 8:22 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 62 204800
356907847 bluket E Jan. 8, 2026, 5:59 a.m. OK C++23 (GCC 14-64, msys2) TESTS 29 78 102400
356859963 ngnsusinn E Jan. 7, 2026, 5:16 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 78 102400
356864962 kcatsuh E Jan. 7, 2026, 5:31 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 78 35942400
356901676 mr_imperfect28 E Jan. 8, 2026, 4:46 a.m. OK C++23 (GCC 14-64, msys2) TESTS 29 93 102400
356884218 Terminator246 E Jan. 7, 2026, 9:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 93 102400
356856733 thenewbiecoder E Jan. 7, 2026, 5:07 p.m. OK GNU C11 TESTS 29 218 614400
356900411 __baozii__ E Jan. 8, 2026, 4:27 a.m. OK Go TESTS 29 125 4812800
356858783 Rick_7799 E Jan. 7, 2026, 5:13 p.m. OK Java 21 TESTS 29 375 1536000
356853329 dhroovs E Jan. 7, 2026, 4:57 p.m. OK Java 21 TESTS 29 687 716800
356859473 rivuprovode123 E Jan. 7, 2026, 5:15 p.m. OK Java 21 TESTS 29 718 512000
356863045 etian6795 E Jan. 7, 2026, 5:26 p.m. OK Java 21 TESTS 29 718 1331200
356851087 ayushmaan1092 E Jan. 7, 2026, 4:51 p.m. OK Java 21 TESTS 29 734 1126400
356850917 ryuk_baba E Jan. 7, 2026, 4:50 p.m. OK Java 21 TESTS 29 859 819200
356873470 amkr6207 E Jan. 7, 2026, 7:08 p.m. OK Java 21 TESTS 29 984 921600
356904809 MBBN E Jan. 8, 2026, 5:24 a.m. OK Java 21 TESTS 29 1093 1331200
356878269 beatinghu E Jan. 7, 2026, 8:01 p.m. OK Java 21 TESTS 29 1828 1536000
356851288 Pulkit_gupta E Jan. 7, 2026, 4:51 p.m. OK PyPy 3-64 TESTS 29 296 9011200
356851639 KokebT E Jan. 7, 2026, 4:52 p.m. OK PyPy 3-64 TESTS 29 343 9011200
356892197 Little_Sheep_Yawn E Jan. 8, 2026, 2:10 a.m. OK PyPy 3-64 TESTS 29 359 10137600
356854109 banibrata2007 E Jan. 7, 2026, 4:59 p.m. OK PyPy 3-64 TESTS 29 390 8294400
356852157 Pushkar_07 E Jan. 7, 2026, 4:54 p.m. OK PyPy 3-64 TESTS 29 390 35020800
356853815 mxq E Jan. 7, 2026, 4:58 p.m. OK PyPy 3-64 TESTS 29 453 8192000
356895197 akshitsinghvi28 E Jan. 8, 2026, 3:07 a.m. OK PyPy 3-64 TESTS 29 468 12390400
356851141 sane_eagle_23 E Jan. 7, 2026, 4:51 p.m. OK PyPy 3-64 TESTS 29 500 9113600
356854388 fatalerror E Jan. 7, 2026, 5 p.m. OK PyPy 3-64 TESTS 29 500 9420800
356865923 SebasMusk E Jan. 7, 2026, 5:33 p.m. OK PyPy 3-64 TESTS 29 500 9625600
356856457 igor99972 E Jan. 7, 2026, 5:06 p.m. OK Python 3 TESTS 29 968 1536000
356855712 Solalyth E Jan. 7, 2026, 5:04 p.m. OK Rust 2021 TESTS 29 546 85606400
356851431 triple_affirmative E Jan. 7, 2026, 4:52 p.m. OK Rust 2024 TESTS 29 203 0

remove filters

Back to search problems