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 |
---|---|---|---|---|---|---|
1909 | Pinely Round 3 (Div. 1 + Div. 2) | FINISHED | False | 10800 | 28481099 | Dec. 23, 2023, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 951 ) | F2 | Small Permutation Problem (Hard Version) | PROGRAMMING | combinatorics dp math |
B'In the easy version, the a_i are in the range [0, n] ; in the hard version, the a_i are in the range [-1, n] and the definition of good permutation is slightly different. You can make hacks only if all versions of the problem are solved. You are given an integer n and an array a_1, a_2, ... , a_n of integers in the range [-1, n] . A permutation p_1, p_2, ... , p_n of [1, 2, ... , n] is good if, for each i , the following condition is true: Count the good permutations of [1, 2, ... , n] , modulo 998 ,244 ,353 . Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^4 ). The description of the test cases follows. The first line of each test case contains a single integer n ( 1 <= q n <= q 2 cdot 10^5 ) -- the length of the array a . The second line of each test case contains n integers a_1, a_2, ldots, a_n ( -1 <= a_i <= n ), which describe the conditions for a good permutation. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output a single line containing the number of good permutations, modulo 998 ,244 ,353 . In the first test case, all the permutations of length 5 are good, so there are 120 good permutations. In the second test case, the only good permutation is [1, 2, 3, 4, 5] . In the third test case, there are 4 good permutations: [2, 1, 5, 6, 3, 4] , [2, 1, 5, 6, 4, 3] , [2, 1, 6, 5, 3, 4] , [2, 1, 6, 5, 4, 3] . For example, [2, 1, 5, 6, 3, 4] is good because: '... |
Editorial of Pinely Round 3 (Div. 1 + Div. 2) |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
238610434 | omeganot | F2 | Dec. 24, 2023, 12:08 a.m. | OK | GNU C++14 | TESTS | 27 | 93 | 3481600 | ||
238579840 | by_chance | F2 | Dec. 23, 2023, 5:08 p.m. | OK | GNU C++14 | TESTS | 27 | 93 | 3481600 | ||
238616142 | zltzlt | F2 | Dec. 24, 2023, 3:07 a.m. | OK | GNU C++14 | TESTS | 27 | 108 | 5836800 | ||
238584275 | Imot | F2 | Dec. 23, 2023, 5:25 p.m. | OK | GNU C++14 | TESTS | 27 | 108 | 5836800 | ||
238584374 | Survivor_winner | F2 | Dec. 23, 2023, 5:25 p.m. | OK | GNU C++14 | TESTS | 27 | 108 | 7475200 | ||
238584289 | cfhj | F2 | Dec. 23, 2023, 5:25 p.m. | OK | GNU C++14 | TESTS | 27 | 109 | 6656000 | ||
238619385 | woee | F2 | Dec. 24, 2023, 4:14 a.m. | OK | GNU C++14 | TESTS | 27 | 109 | 15462400 | ||
238585035 | 0wuming0 | F2 | Dec. 23, 2023, 5:27 p.m. | OK | GNU C++14 | TESTS | 27 | 124 | 11468800 | ||
238576131 | HackerMonk | F2 | Dec. 23, 2023, 4:55 p.m. | OK | GNU C++14 | TESTS | 27 | 140 | 29081600 | ||
238583244 | xsap | F2 | Dec. 23, 2023, 5:21 p.m. | OK | GNU C++14 | TESTS | 27 | 171 | 7475200 | ||
238585686 | eunlin | F2 | Dec. 23, 2023, 5:29 p.m. | OK | GNU C++17 | TESTS | 27 | 78 | 5120000 | ||
238577238 | ZzzzRKkkkkRrrrr | F2 | Dec. 23, 2023, 4:58 p.m. | OK | GNU C++17 | TESTS | 27 | 78 | 5120000 | ||
238586034 | LLyw6 | F2 | Dec. 23, 2023, 5:30 p.m. | OK | GNU C++17 | TESTS | 27 | 93 | 5120000 | ||
238583098 | Potassium | F2 | Dec. 23, 2023, 5:21 p.m. | OK | GNU C++17 | TESTS | 27 | 93 | 5120000 | ||
238607640 | Ronnie007 | F2 | Dec. 23, 2023, 10:22 p.m. | OK | GNU C++17 | TESTS | 27 | 93 | 6656000 | ||
238580507 | ikaurov | F2 | Dec. 23, 2023, 5:10 p.m. | OK | GNU C++17 | TESTS | 27 | 93 | 6656000 | ||
238609670 | DemberS06 | F2 | Dec. 23, 2023, 11:35 p.m. | OK | GNU C++17 | TESTS | 27 | 93 | 17510400 | ||
238577425 | kostyamyasso2002 | F2 | Dec. 23, 2023, 4:59 p.m. | OK | GNU C++17 | TESTS | 27 | 108 | 5120000 | ||
238577036 | feeder1 | F2 | Dec. 23, 2023, 4:58 p.m. | OK | GNU C++17 | TESTS | 27 | 109 | 5120000 | ||
238581798 | KumaTachiRen | F2 | Dec. 23, 2023, 5:15 p.m. | OK | GNU C++17 | TESTS | 27 | 109 | 5427200 | ||
238617407 | Xueyi | F2 | Dec. 24, 2023, 3:37 a.m. | OK | GNU C++17 (64) | TESTS | 27 | 46 | 3686400 | ||
238590526 | little_misfortune | F2 | Dec. 23, 2023, 6:16 p.m. | OK | GNU C++17 (64) | TESTS | 27 | 46 | 3686400 | ||
238613828 | y_combinator | F2 | Dec. 24, 2023, 2:12 a.m. | OK | GNU C++17 (64) | TESTS | 27 | 46 | 4198400 | ||
238620568 | LXH-cat | F2 | Dec. 24, 2023, 4:36 a.m. | OK | GNU C++17 (64) | TESTS | 27 | 46 | 4403200 | ||
238599859 | MarcosK | F2 | Dec. 23, 2023, 7:52 p.m. | OK | GNU C++17 (64) | TESTS | 27 | 61 | 6041600 | ||
238616662 | Xellos | F2 | Dec. 24, 2023, 3:19 a.m. | OK | GNU C++17 (64) | TESTS | 27 | 61 | 8499200 | ||
238616652 | old_wrp | F2 | Dec. 24, 2023, 3:19 a.m. | OK | GNU C++17 (64) | TESTS | 27 | 62 | 3686400 | ||
238609232 | kondasujay2 | F2 | Dec. 23, 2023, 11:18 p.m. | OK | GNU C++17 (64) | TESTS | 27 | 62 | 3686400 | ||
238598207 | GoogleBot | F2 | Dec. 23, 2023, 7:29 p.m. | OK | GNU C++17 (64) | TESTS | 27 | 62 | 5222400 | ||
238619561 | qkm66666 | F2 | Dec. 24, 2023, 4:17 a.m. | OK | GNU C++17 (64) | TESTS | 27 | 62 | 6860800 | ||
238617469 | llloserqz | F2 | Dec. 24, 2023, 3:38 a.m. | OK | GNU C++20 (64) | TESTS | 27 | 46 | 3686400 | ||
238586078 | Zan | F2 | Dec. 23, 2023, 5:31 p.m. | OK | GNU C++20 (64) | TESTS | 27 | 46 | 3686400 | ||
238583645 | cabbit | F2 | Dec. 23, 2023, 5:22 p.m. | OK | GNU C++20 (64) | TESTS | 27 | 46 | 3686400 | ||
238583629 | W4P3R | F2 | Dec. 23, 2023, 5:22 p.m. | OK | GNU C++20 (64) | TESTS | 27 | 46 | 3686400 | ||
238583541 | nhuang685 | F2 | Dec. 23, 2023, 5:22 p.m. | OK | GNU C++20 (64) | TESTS | 27 | 46 | 3686400 | ||
238582998 | AmShZ | F2 | Dec. 23, 2023, 5:20 p.m. | OK | GNU C++20 (64) | TESTS | 27 | 46 | 3686400 | ||
238608253 | eyadhjarray111 | F2 | Dec. 23, 2023, 10:43 p.m. | OK | GNU C++20 (64) | TESTS | 27 | 46 | 4505600 | ||
238591192 | warner1129 | F2 | Dec. 23, 2023, 6:20 p.m. | OK | GNU C++20 (64) | TESTS | 27 | 46 | 4505600 | ||
238582265 | tinca_matei | F2 | Dec. 23, 2023, 5:17 p.m. | OK | GNU C++20 (64) | TESTS | 27 | 46 | 4505600 | ||
238612200 | HugeWide | F2 | Dec. 24, 2023, 1:23 a.m. | OK | GNU C++20 (64) | TESTS | 27 | 46 | 5222400 | ||
238586872 | knightL | F2 | Dec. 23, 2023, 5:33 p.m. | OK | Java 17 | TESTS | 27 | 249 | 44851200 | ||
238577503 | chinerist | F2 | Dec. 23, 2023, 4:59 p.m. | OK | PyPy 3-64 | TESTS | 27 | 327 | 69836800 | ||
238601001 | conqueror_of_tourist | F2 | Dec. 23, 2023, 8:09 p.m. | OK | PyPy 3-64 | TESTS | 27 | 389 | 74956800 | ||
238596081 | ManojkumarPatanik | F2 | Dec. 23, 2023, 7:02 p.m. | OK | PyPy 3-64 | TESTS | 27 | 639 | 63078400 | ||
238589624 | bronze_coder | F2 | Dec. 23, 2023, 6:12 p.m. | OK | PyPy 3-64 | TESTS | 27 | 639 | 63078400 | ||
238575894 | sansen | F2 | Dec. 23, 2023, 4:54 p.m. | OK | Rust 2021 | TESTS | 27 | 30 | 9728000 | ||
238611732 | kost | F2 | Dec. 24, 2023, 1:06 a.m. | OK | Rust 2021 | TESTS | 27 | 93 | 15974400 |
Back to search problems