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 |
|---|---|---|---|---|---|---|
| 2255 | Codeforces Round 1116 (Div. 1) | FINISHED | False | 9000 | 2820275 | Aug. 9, 2026, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 263 ) | F | Who Will Witness the End? | PROGRAMMING | fft math |
Before her final sortie, Chtholly asks Willem three questions. The third is this: when the end finally comes, who will remain to witness it? Willem cannot answer her directly. Instead, he draws a circle on the board, calling it the ring of all things, and writes down (n) labeled integers (a_1,a_2,\ldots,a_n). Every possible order around the ring describes a different way in which the world might reach its end. Consider a permutation (p_1,p_2,\ldots,p_n) of the integers from (1) to (n). Place the corresponding numbers on a circle in this order. The weight of the resulting circular arrangement is () \prod_{i=1}^{n}(a_{p_i}+a_{p_{i+1}}), () where (p_{n+1}=p_1). Two permutations describe the same circular arrangement if one can be obtained from the other by a cyclic shift. Reversing an arrangement does not make it the same arrangement; in other words, reflected arrangements are considered different unless they also coincide after a cyclic shift. Find the sum of the weights of all distinct circular arrangements. Since the answer may be large, output it modulo (998\,244\,353). 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. The first line of each test case contains one integer (n) ((3 \le n \le 2\cdot 10^5)) — the number of labeled integers. The second line contains (n) integers (a_1,a_2,\ldots,a_n) ((0 \le a_i \lt 998\,244\,353)). It is guaranteed that the sum of (n) over all test cases does not exceed (2\cdot 10^5). For each test case, output one integer — the sum of the weights of all distinct circular arrangements, modulo (998\,244\,353). In the first test case, there are two distinct circular arrangements. They can be represented by the permutations (1,2,3) and (1,3,2). Both have weight () (1+2)(2+3)(3+1)=60, () so the answer is (120). In the second t |
| 155840 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 386404987 | rnzhemvhtm | F | Aug. 9, 2026, 6:03 p.m. | OK | C++17 (GCC 7-32) | TESTS | 41 | 640 | 3584000 | ||
| 386429369 | linhthi | F | Aug. 10, 2026, 2:46 a.m. | OK | C++17 (GCC 7-32) | TESTS | 41 | 640 | 5939200 | ||
| 386396556 | Kieray | F | Aug. 9, 2026, 4:55 p.m. | OK | C++17 (GCC 7-32) | TESTS | 41 | 906 | 14438400 | ||
| 386422114 | Yazan570 | F | Aug. 9, 2026, 11:33 p.m. | OK | C++17 (GCC 7-32) | TESTS | 41 | 1187 | 4915200 | ||
| 386423923 | MHaque | F | Aug. 10, 2026, 12:43 a.m. | OK | C++17 (GCC 7-32) | TESTS | 41 | 1390 | 5836800 | ||
| 386426353 | milky0002 | F | Aug. 10, 2026, 1:46 a.m. | OK | C++17 (GCC 7-32) | TESTS | 41 | 1500 | 8704000 | ||
| 386426869 | zeroliebe | F | Aug. 10, 2026, 1:57 a.m. | OK | C++20 (GCC 13-64) | TESTS | 41 | 281 | 8499200 | ||
| 386412491 | aiunittest | F | Aug. 9, 2026, 7:35 p.m. | OK | C++20 (GCC 13-64) | TESTS | 41 | 406 | 8294400 | ||
| 386423457 | szsyhh | F | Aug. 10, 2026, 12:26 a.m. | OK | C++20 (GCC 13-64) | TESTS | 41 | 531 | 10240000 | ||
| 386429424 | gopal.thecoder | F | Aug. 10, 2026, 2:47 a.m. | OK | C++20 (GCC 13-64) | TESTS | 41 | 593 | 20582400 | ||
| 386403358 | MarieBiskoot | F | Aug. 9, 2026, 5:47 p.m. | OK | C++20 (GCC 13-64) | TESTS | 41 | 593 | 20889600 | ||
| 386408250 | PelicanPilot | F | Aug. 9, 2026, 6:37 p.m. | OK | C++20 (GCC 13-64) | TESTS | 41 | 734 | 2355200 | ||
| 386401073 | Asakizz | F | Aug. 9, 2026, 5:26 p.m. | OK | C++20 (GCC 13-64) | TESTS | 41 | 812 | 9011200 | ||
| 386395849 | harmis_yz | F | Aug. 9, 2026, 4:52 p.m. | OK | C++20 (GCC 13-64) | TESTS | 41 | 859 | 12800000 | ||
| 386431181 | masy2011 | F | Aug. 10, 2026, 3:21 a.m. | OK | C++20 (GCC 13-64) | TESTS | 41 | 953 | 21606400 | ||
| 386430292 | lucifer2k8 | F | Aug. 10, 2026, 3:04 a.m. | OK | C++20 (GCC 13-64) | TESTS | 41 | 1062 | 13209600 | ||
| 386425549 | paulzrm | F | Aug. 10, 2026, 1:29 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 41 | 421 | 3276800 | ||
| 386432152 | Wangy | F | Aug. 10, 2026, 3:40 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 41 | 437 | 2457600 | ||
| 386400903 | MusicBox | F | Aug. 9, 2026, 5:25 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 41 | 453 | 2662400 | ||
| 386405447 | lgmpvhung | F | Aug. 9, 2026, 6:08 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 41 | 468 | 13824000 | ||
| 386409001 | glee_lily_ | F | Aug. 9, 2026, 6:47 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 41 | 484 | 3174400 | ||
| 386411539 | T4640 | F | Aug. 9, 2026, 7:21 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 41 | 484 | 6246400 | ||
| 386410613 | basTestKeliye | F | Aug. 9, 2026, 7:08 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 41 | 687 | 12697600 | ||
| 386401274 | woyebuzhidaowoshishui | F | Aug. 9, 2026, 5:28 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 41 | 718 | 13926400 | ||
| 386426773 | ramumali2002 | F | Aug. 10, 2026, 1:55 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 41 | 765 | 26521600 | ||
| 386402862 | no_comments | F | Aug. 9, 2026, 5:42 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 41 | 812 | 26521600 | ||
| 386426688 | smilences | F | Aug. 10, 2026, 1:53 a.m. | OK | PyPy 3-64 | TESTS | 41 | 1015 | 55500800 | ||
| 386430607 | code.demon | F | Aug. 10, 2026, 3:10 a.m. | OK | PyPy 3-64 | TESTS | 41 | 1109 | 55603200 | ||
| 386400892 | d11maan | F | Aug. 9, 2026, 5:25 p.m. | OK | Rust 2024 | TESTS | 41 | 515 | 21606400 |
Back to search problems