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 |
|---|---|---|---|---|---|---|
| 2226 | Codeforces Round 1095 (Div. 2) | FINISHED | False | 8100 | 1178664 | April 28, 2026, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 139 ) | G | Stop Spot | PROGRAMMING | strings trees |
You are given an array (a) of size (n) ((1 \leq a_i \leq m)). Consider all (m!) permutations of the array (1, 2, \ldots, m). For any permutation (p), define the array (b_p) as the array formed by concatenating the array (a) and the permutation (p). More formally, (b_p = a_1, a_2, \ldots, a_n, p_1, p_2, \ldots, p_m). Let (f(i)) denote the number of permutations (p) such that the array (b_p) contains exactly (i) palindromic(^{\text{∗}}) subarrays of even length . Your task is to compute () \sum_{i=0}^{10^{100}} f(i)^{i+1}.() Since the answer may be large, it should be computed modulo (998\,244\,353). (^{\text{∗}})An array (c_1, c_2, \ldots, c_k) is said to be palindromic if (c_i = c_{k+1-i}) for all (1 \le i \le k). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^5)). The description of the test cases follows. The first line of each testcase contains two integers (n) and (m) ((1 \le m \le n \le 10^6)). The second line of each testcase contains (n) integers (a_1, a_2, \ldots, a_n) ((1 \le a_i \le m)) — the elements of the array. It is guaranteed that the sum of (n) over all test cases does not exceed (10^6). For each testcase, print a single integer on a new line — (\sum_{i=0}^{10^{100}} f(i)^{i+1}) modulo (998\,244\,353). In the first test case, (n=4), (m=3), and (a=3,1,2,1). Let's list all permutations and calculate the number of palindromic subarrays of even length: (p_1 = 1, 2, 3), (b_{p_1} = 3, 1, 2, 1, 1, 2, 3), and the number of palindromic subarrays of even length is (2). (p_2 = 1, 3, 2), (b_{p_2} = 3, 1, 2, 1, 1, 3, 2), and the number of palindromic subarrays of even length is (1). (p_3 = 2, 1, 3), (b_{p_3} = 3, 1, 2, 1, 2, 1, 3), and the number of palindromic subarrays of even length is $$$0 |
| Codeforces Round 1095 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 372886303 | _.rajababu | G | April 28, 2026, 7:19 p.m. | OK | C++17 (GCC 7-32) | TESTS | 55 | 343 | 29798400 | ||
| 372879710 | wsra | G | April 28, 2026, 6:07 p.m. | OK | C++17 (GCC 7-32) | TESTS | 55 | 375 | 15257600 | ||
| 372857635 | potato167 | G | April 28, 2026, 3:57 p.m. | OK | C++17 (GCC 7-32) | TESTS | 54 | 468 | 26419200 | ||
| 372866884 | ProG0206 | G | April 28, 2026, 4:28 p.m. | OK | C++17 (GCC 7-32) | TESTS | 54 | 484 | 16281600 | ||
| 372875281 | CareCare | G | April 28, 2026, 5:26 p.m. | OK | C++17 (GCC 7-32) | TESTS | 54 | 484 | 95436800 | ||
| 372885115 | teplohod | G | April 28, 2026, 7:05 p.m. | OK | C++17 (GCC 7-32) | TESTS | 55 | 562 | 28876800 | ||
| 372860436 | RustyPanda | G | April 28, 2026, 4:06 p.m. | OK | C++17 (GCC 7-32) | TESTS | 54 | 578 | 74649600 | ||
| 372893183 | adit098 | G | April 28, 2026, 9:06 p.m. | OK | C++17 (GCC 7-32) | TESTS | 55 | 640 | 101171200 | ||
| 372862702 | lyb1010752657 | G | April 28, 2026, 4:14 p.m. | OK | C++17 (GCC 7-32) | TESTS | 54 | 687 | 46899200 | ||
| 372877889 | SDSXC | G | April 28, 2026, 5:49 p.m. | OK | C++17 (GCC 7-32) | TESTS | 55 | 1625 | 380928000 | ||
| 372871386 | 3makgee | G | April 28, 2026, 4:45 p.m. | OK | C++20 (GCC 13-64) | TESTS | 54 | 296 | 27545600 | ||
| 372864628 | rns_jhm | G | April 28, 2026, 4:20 p.m. | OK | C++20 (GCC 13-64) | TESTS | 54 | 328 | 19353600 | ||
| 372880069 | CPluhPluh | G | April 28, 2026, 6:11 p.m. | OK | C++20 (GCC 13-64) | TESTS | 55 | 328 | 47923200 | ||
| 372878300 | Eren12 | G | April 28, 2026, 5:54 p.m. | OK | C++20 (GCC 13-64) | TESTS | 55 | 343 | 73625600 | ||
| 372870317 | lucdoka1245 | G | April 28, 2026, 4:41 p.m. | OK | C++20 (GCC 13-64) | TESTS | 54 | 359 | 31846400 | ||
| 372875159 | passwords | G | April 28, 2026, 5:25 p.m. | OK | C++20 (GCC 13-64) | TESTS | 54 | 375 | 24166400 | ||
| 372891412 | OG_Matveychick1 | G | April 28, 2026, 8:31 p.m. | OK | C++20 (GCC 13-64) | TESTS | 55 | 375 | 83046400 | ||
| 372876938 | SATSKY_2025target_LGM | G | April 28, 2026, 5:40 p.m. | OK | C++20 (GCC 13-64) | TESTS | 54 | 390 | 43724800 | ||
| 372898692 | masy2011 | G | April 29, 2026, 12:10 a.m. | OK | C++20 (GCC 13-64) | TESTS | 56 | 390 | 92569600 | ||
| 372872179 | Wonderwoman2017 | G | April 28, 2026, 4:48 p.m. | OK | C++20 (GCC 13-64) | TESTS | 54 | 437 | 37478400 | ||
| 372875422 | mister_algoritm | G | April 28, 2026, 5:27 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 54 | 281 | 13516800 | ||
| 372867791 | StarSilk | G | April 28, 2026, 4:32 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 54 | 281 | 132300800 | ||
| 372885660 | 424479543 | G | April 28, 2026, 7:10 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 55 | 281 | 133017600 | ||
| 372881119 | hardcorecrayon3 | G | April 28, 2026, 6:20 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 55 | 312 | 37990400 | ||
| 372871564 | peti1234 | G | April 28, 2026, 4:46 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 54 | 328 | 95846400 | ||
| 372862333 | Program_Destroyer | G | April 28, 2026, 4:13 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 54 | 343 | 12492800 | ||
| 372885250 | abcd123131213 | G | April 28, 2026, 7:06 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 55 | 343 | 24576000 | ||
| 372871714 | donnyooo | G | April 28, 2026, 4:47 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 54 | 343 | 50073600 | ||
| 372870532 | Sugar_fan | G | April 28, 2026, 4:42 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 54 | 375 | 51097600 | ||
| 372870699 | YuukiS | G | April 28, 2026, 4:43 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 54 | 375 | 108851200 | ||
| 372871945 | Hitansu | G | April 28, 2026, 4:47 p.m. | OK | Java 21 | TESTS | 54 | 500 | 18227200 | ||
| 372872034 | tusaryan | G | April 28, 2026, 4:48 p.m. | OK | Java 21 | TESTS | 54 | 625 | 58060800 | ||
| 372866526 | gagan_singh | G | April 28, 2026, 4:27 p.m. | OK | Java 8 | TESTS | 54 | 406 | 234393600 | ||
| 372857811 | NaughtyIndia01 | G | April 28, 2026, 3:57 p.m. | OK | PyPy 3-64 | TESTS | 54 | 562 | 115200000 | ||
| 372871861 | Daddydan21 | G | April 28, 2026, 4:47 p.m. | OK | PyPy 3-64 | TESTS | 54 | 718 | 120729600 | ||
| 372870117 | Sacred_Conqueror | G | April 28, 2026, 4:41 p.m. | OK | PyPy 3-64 | TESTS | 54 | 750 | 211660800 | ||
| 372866150 | TYP_LongHD | G | April 28, 2026, 4:26 p.m. | OK | Python 3 | TESTS | 54 | 1125 | 104038400 | ||
| 372870034 | palodkrish | G | April 28, 2026, 4:40 p.m. | OK | Python 3 | TESTS | 54 | 1234 | 106393600 |
Back to search problems