Codeforces Round 819 (Div. 1 + Div. 2) and Grimoire of Code Annual Contest 2022

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
1726 Codeforces Round 819 (Div. 1 + Div. 2) and Grimoire of Code Annual Contest 2022 FINISHED False 8100 69348299 Sept. 6, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1434 ) E Almost Perfect PROGRAMMING combinatorics fft math

B'A permutation p of length n is called almost perfect if for all integer 1 <= q i <= q n , it holds that lvert p_i - p^{-1}_i rvert <= 1 , where p^{-1} is the inverse permutation of p (i.e. p^{-1}_{k_1} = k_2 if and only if p_{k_2} = k_1 ). Count the number of almost perfect permutations of length n modulo 998244353 . The first line contains a single integer t ( 1 <= q t <= q 1000 ) -- the number of test cases. The description of each test case follows. The first and only line of each test case contains a single integer n ( 1 <= q n <= q 3 cdot 10^5 ) -- the length of the permutation. It is guaranteed that the sum of n over all test cases does not exceed 3 cdot 10^5 . For each test case, output a single integer -- the number of almost perfect permutations of length n modulo 998244353 . For n = 2 , both permutations [1, 2] , and [2, 1] are almost perfect. For n = 3 , there are only 6 permutations. Having a look at all of them gives us: So we get 4 almost perfect permutations. '...

Tutorials

Codeforces Round #819 (Div. 1 + Div. 2) and Grimoire of Code Annual Contest 2022 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
171142662 Gassa E Sept. 6, 2022, 4:30 p.m. OK D TESTS 15 202 16793600
171157118 chro4896 E Sept. 6, 2022, 6:03 p.m. OK GNU C11 TESTS 15 31 7168000
171149518 Unique_Hanpi E Sept. 6, 2022, 4:47 p.m. OK GNU C++14 TESTS 15 15 7270400
171158267 Gemini7X E Sept. 6, 2022, 6:12 p.m. OK GNU C++14 TESTS 15 31 3584000
171191530 grass8cow E Sept. 7, 2022, 4:25 a.m. OK GNU C++14 TESTS 15 31 3584000
171157828 ghj1222 E Sept. 6, 2022, 6:08 p.m. OK GNU C++14 TESTS 15 31 4812800
171145655 zenghaowei E Sept. 6, 2022, 4:37 p.m. OK GNU C++14 TESTS 15 31 7168000
171180556 omeganot E Sept. 7, 2022, 12:26 a.m. OK GNU C++14 TESTS 15 31 7270400
171186309 nixnehc E Sept. 7, 2022, 2:37 a.m. OK GNU C++14 TESTS 15 31 7270400
171162979 walk_alone E Sept. 6, 2022, 6:51 p.m. OK GNU C++14 TESTS 15 31 9625600
171188588 RayLuo E Sept. 7, 2022, 3:27 a.m. OK GNU C++14 TESTS 15 31 9625600
171185449 stOzenghaoweiOrz E Sept. 7, 2022, 2:17 a.m. OK GNU C++14 TESTS 15 31 9728000
171143702 orangecalculator E Sept. 6, 2022, 4:33 p.m. OK GNU C++17 TESTS 15 31 2457600
171154507 Aging1986 E Sept. 6, 2022, 5:48 p.m. OK GNU C++17 TESTS 15 31 3584000
171142377 Frank_DD E Sept. 6, 2022, 4:29 p.m. OK GNU C++17 TESTS 15 31 3584000
171183548 CSCSX E Sept. 7, 2022, 1:37 a.m. OK GNU C++17 TESTS 15 31 3584000
171182448 qianyue E Sept. 7, 2022, 1:11 a.m. OK GNU C++17 TESTS 15 31 3891200
171150056 geruome E Sept. 6, 2022, 4:48 p.m. OK GNU C++17 TESTS 15 31 6041600
171150620 wildwolf_pty E Sept. 6, 2022, 4:49 p.m. OK GNU C++17 TESTS 15 31 6041600
171194005 LuoShaoyinn E Sept. 7, 2022, 5:08 a.m. OK GNU C++17 TESTS 15 31 7270400
171165819 anatolik E Sept. 6, 2022, 7:22 p.m. OK GNU C++17 TESTS 15 31 7270400
171188701 Scorpioch E Sept. 7, 2022, 3:29 a.m. OK GNU C++17 TESTS 15 31 7987200
171194327 asd12 E Sept. 7, 2022, 5:14 a.m. OK GNU C++17 (64) TESTS 15 15 3584000
171143185 Zappeko E Sept. 6, 2022, 4:31 p.m. OK GNU C++17 (64) TESTS 15 15 7270400
171188242 2_3_3 E Sept. 7, 2022, 3:19 a.m. OK GNU C++17 (64) TESTS 15 30 16076800
171182288 f.a- E Sept. 7, 2022, 1:07 a.m. OK GNU C++17 (64) TESTS 15 31 3584000
171196077 jinqihao2023 E Sept. 7, 2022, 5:42 a.m. OK GNU C++17 (64) TESTS 15 31 4812800
171190820 zhangboju E Sept. 7, 2022, 4:11 a.m. OK GNU C++17 (64) TESTS 15 31 4812800
171188370 Intercept E Sept. 7, 2022, 3:22 a.m. OK GNU C++17 (64) TESTS 15 31 4812800
171182386 yzc2005 E Sept. 7, 2022, 1:10 a.m. OK GNU C++17 (64) TESTS 15 31 6041600
171167729 I_HATE_GEOMETRY E Sept. 6, 2022, 7:45 p.m. OK GNU C++17 (64) TESTS 15 31 6041600
171154425 bashkort E Sept. 6, 2022, 5:48 p.m. OK GNU C++17 (64) TESTS 15 31 6451200
171183894 Thallium54 E Sept. 7, 2022, 1:45 a.m. OK GNU C++20 (64) TESTS 15 15 3584000
171157214 rgnerdplayer E Sept. 6, 2022, 6:04 p.m. OK GNU C++20 (64) TESTS 15 15 3584000
171157132 rgnerdplayer E Sept. 6, 2022, 6:03 p.m. OK GNU C++20 (64) TESTS 15 15 3584000
171185661 conzloi E Sept. 7, 2022, 2:22 a.m. OK GNU C++20 (64) TESTS 15 15 3584000
171182017 ButterCake E Sept. 7, 2022, 1:01 a.m. OK GNU C++20 (64) TESTS 15 15 4812800
171142493 brunovsky E Sept. 6, 2022, 4:29 p.m. OK GNU C++20 (64) TESTS 15 15 6348800
171197349 __wizard_of_oz__ E Sept. 7, 2022, 6 a.m. OK GNU C++20 (64) TESTS 15 15 7168000
171148457 VHTung E Sept. 6, 2022, 4:45 p.m. OK GNU C++20 (64) TESTS 15 15 7270400
171154683 physics0523 E Sept. 6, 2022, 5:49 p.m. OK GNU C++20 (64) TESTS 15 15 12595200
171186850 _BottomCoder_ E Sept. 7, 2022, 2:50 a.m. OK GNU C++20 (64) TESTS 15 30 3584000
171154828 freehandle E Sept. 6, 2022, 5:49 p.m. OK Java 17 TESTS 15 592 204800
171148447 stgatilov E Sept. 6, 2022, 4:45 p.m. OK MS C++ 2017 TESTS 15 140 16793600
171148567 tarattata1 E Sept. 6, 2022, 4:45 p.m. OK MS C++ 2017 TESTS 15 249 9625600
171154580 misorin E Sept. 6, 2022, 5:48 p.m. OK PyPy 3 TESTS 15 514 63385600
171166488 plevande E Sept. 6, 2022, 7:30 p.m. OK PyPy 3 TESTS 15 701 84070400
171156216 titia E Sept. 6, 2022, 5:57 p.m. OK PyPy 3 TESTS 15 997 125440000
171149274 googlweknoall E Sept. 6, 2022, 4:46 p.m. OK PyPy 3-64 TESTS 15 140 13926400
171160399 roaris E Sept. 6, 2022, 6:28 p.m. OK PyPy 3-64 TESTS 15 140 14028800
171154880 duck702702 E Sept. 6, 2022, 5:49 p.m. OK PyPy 3-64 TESTS 15 202 22016000

remove filters

Back to search problems