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 |
---|---|---|---|---|---|---|
1698 | Codeforces Round 803 (Div. 2) | FINISHED | False | 8100 | 80753063 | June 28, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 1669 ) | E | PermutationForces II | PROGRAMMING | binary search brute force combinatorics constructive algorithms greedy sortings |
B'You are given a permutation a of length n . Recall that permutation is an array consisting of n distinct integers from 1 to n in arbitrary order. You have a strength of s and perform n moves on the permutation a . The i -th move consists of the following: You want to turn a into another permutation b after n moves. However, some elements of b are missing and are replaced with -1 instead. Count the number of ways to replace each -1 in b with some integer from 1 to n so that b is a permutation and it is possible to turn a into b with a strength of s . Since the answer can be large, output it modulo 998 ,244 ,353 . The input consists of multiple test cases. The first line contains an integer t ( 1 <= q t <= q 1000 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains two integers n and s ( 1 <= q n <= q 2 cdot 10^5 ; 1 <= q s <= q n ) -- the size of the permutation and your strength, respectively. The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= n ) -- the elements of a . All elements of a are distinct. The third line of each test case contains n integers b_1, b_2, ldots, b_n ( 1 <= b_i <= n or b_i = -1 ) -- the elements of b . All elements of b that are not equal to -1 are distinct. 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 integer -- the number of ways to fill up the permutation b so that it is possible to turn a into b using a strength of s , modulo 998 ,244 ,353 . In the first test case, a=[2,1,3] . There are two possible ways to fill out the -1 s in b to make it a permutation: '... |
Codeforces Round #803 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
162158684 | rainboy | E | June 28, 2022, 5:31 p.m. | OK | GNU C11 | TESTS | 16 | 78 | 1843200 | ||
162183910 | win10 | E | June 28, 2022, 11:55 p.m. | OK | GNU C++14 | TESTS | 16 | 30 | 6144000 | ||
162196932 | JoesSR | E | June 29, 2022, 4:11 a.m. | OK | GNU C++14 | TESTS | 16 | 78 | 3174400 | ||
162188389 | Sonnoz | E | June 29, 2022, 1:43 a.m. | OK | GNU C++14 | TESTS | 16 | 93 | 3174400 | ||
162187950 | zhiyangfan | E | June 29, 2022, 1:36 a.m. | OK | GNU C++14 | TESTS | 16 | 93 | 3174400 | ||
162200615 | minsiqi | E | June 29, 2022, 5:08 a.m. | OK | GNU C++14 | TESTS | 16 | 93 | 3174400 | ||
162197969 | Syf2020 | E | June 29, 2022, 4:28 a.m. | OK | GNU C++14 | TESTS | 16 | 93 | 3993600 | ||
162159852 | wuhudsm | E | June 28, 2022, 5:38 p.m. | OK | GNU C++14 | TESTS | 16 | 93 | 20070400 | ||
162165220 | omeganot | E | June 28, 2022, 6:17 p.m. | OK | GNU C++14 | TESTS | 16 | 108 | 3174400 | ||
162159765 | paxaq | E | June 28, 2022, 5:37 p.m. | OK | GNU C++14 | TESTS | 16 | 108 | 6041600 | ||
162199505 | kkkqqk | E | June 29, 2022, 4:52 a.m. | OK | GNU C++14 | TESTS | 16 | 109 | 4608000 | ||
162204450 | Bobocan | E | June 29, 2022, 6 a.m. | OK | GNU C++17 | TESTS | 16 | 31 | 4505600 | ||
162160479 | opportunityfan | E | June 28, 2022, 5:42 p.m. | OK | GNU C++17 | TESTS | 16 | 93 | 2764800 | ||
162181573 | CReaper1116 | E | June 28, 2022, 10:40 p.m. | OK | GNU C++17 | TESTS | 16 | 93 | 3174400 | ||
162196499 | egret | E | June 29, 2022, 4:04 a.m. | OK | GNU C++17 | TESTS | 16 | 93 | 3174400 | ||
162181462 | CReaper1116 | E | June 28, 2022, 10:37 p.m. | OK | GNU C++17 | TESTS | 16 | 93 | 4812800 | ||
162158773 | dtc03012 | E | June 28, 2022, 5:32 p.m. | OK | GNU C++17 | TESTS | 16 | 93 | 6860800 | ||
162194954 | Mohammad.Nour | E | June 29, 2022, 3:38 a.m. | OK | GNU C++17 | TESTS | 16 | 93 | 10035200 | ||
162186926 | nitss9 | E | June 29, 2022, 1:16 a.m. | OK | GNU C++17 | TESTS | 16 | 108 | 3174400 | ||
162183054 | im.priyansh | E | June 28, 2022, 11:28 p.m. | OK | GNU C++17 | TESTS | 16 | 108 | 5222400 | ||
162204175 | Go8 | E | June 29, 2022, 5:57 a.m. | OK | GNU C++17 | TESTS | 16 | 108 | 5836800 | ||
162196162 | CharlesWuQiushi | E | June 29, 2022, 3:59 a.m. | OK | GNU C++17 (64) | TESTS | 16 | 15 | 4710400 | ||
162160598 | alif_cse_ju | E | June 28, 2022, 5:43 p.m. | OK | GNU C++17 (64) | TESTS | 16 | 61 | 1843200 | ||
162179797 | sweetpotato2 | E | June 28, 2022, 9:49 p.m. | OK | GNU C++17 (64) | TESTS | 16 | 62 | 2457600 | ||
162196115 | wuhypzz | E | June 29, 2022, 3:58 a.m. | OK | GNU C++17 (64) | TESTS | 16 | 62 | 2560000 | ||
162201774 | OTTFF | E | June 29, 2022, 5:24 a.m. | OK | GNU C++17 (64) | TESTS | 16 | 62 | 3174400 | ||
162180740 | wrc | E | June 28, 2022, 10:15 p.m. | OK | GNU C++17 (64) | TESTS | 16 | 62 | 3174400 | ||
162204144 | euoao | E | June 29, 2022, 5:56 a.m. | OK | GNU C++17 (64) | TESTS | 16 | 62 | 4505600 | ||
162187696 | guud222 | E | June 29, 2022, 1:31 a.m. | OK | GNU C++17 (64) | TESTS | 16 | 62 | 4812800 | ||
162200178 | suzuken_w | E | June 29, 2022, 5:02 a.m. | OK | GNU C++17 (64) | TESTS | 16 | 62 | 4812800 | ||
162187631 | guud222 | E | June 29, 2022, 1:30 a.m. | OK | GNU C++17 (64) | TESTS | 16 | 62 | 4812800 | ||
162199434 | Eziotao | E | June 29, 2022, 4:51 a.m. | OK | GNU C++20 (64) | TESTS | 16 | 31 | 7372800 | ||
162194457 | Setsuna | E | June 29, 2022, 3:30 a.m. | OK | GNU C++20 (64) | TESTS | 16 | 46 | 3276800 | ||
162189218 | zn_com | E | June 29, 2022, 1:58 a.m. | OK | GNU C++20 (64) | TESTS | 16 | 46 | 3993600 | ||
162178091 | Nuzleaf | E | June 28, 2022, 9:09 p.m. | OK | GNU C++20 (64) | TESTS | 16 | 46 | 4812800 | ||
162194568 | tojia | E | June 29, 2022, 3:32 a.m. | OK | GNU C++20 (64) | TESTS | 16 | 46 | 5017600 | ||
162169424 | lis05 | E | June 28, 2022, 6:57 p.m. | OK | GNU C++20 (64) | TESTS | 16 | 46 | 5324800 | ||
162160329 | Gapzinho | E | June 28, 2022, 5:41 p.m. | OK | GNU C++20 (64) | TESTS | 16 | 46 | 32051200 | ||
162164444 | caan_do | E | June 28, 2022, 6:11 p.m. | OK | GNU C++20 (64) | TESTS | 16 | 61 | 4812800 | ||
162167269 | spipipike | E | June 28, 2022, 6:35 p.m. | OK | GNU C++20 (64) | TESTS | 16 | 61 | 5324800 | ||
162181984 | WCG | E | June 28, 2022, 10:53 p.m. | OK | GNU C++20 (64) | TESTS | 16 | 62 | 3993600 | ||
162173848 | freehandle | E | June 28, 2022, 7:55 p.m. | OK | Java 11 | TESTS | 16 | 233 | 716800 | ||
162176229 | SlavaG | E | June 28, 2022, 8:34 p.m. | OK | Kotlin 1.6 | TESTS | 16 | 530 | 26726400 | ||
162167602 | mircea85 | E | June 28, 2022, 6:38 p.m. | OK | Mono C# | TESTS | 16 | 248 | 54374400 | ||
162199815 | xxafhixx | E | June 29, 2022, 4:57 a.m. | OK | MS C++ 2017 | TESTS | 16 | 280 | 3276800 | ||
162154282 | coconut99 | E | June 28, 2022, 4:49 p.m. | OK | MS C++ 2017 | TESTS | 16 | 280 | 4608000 | ||
162156477 | Bossusuprem | E | June 28, 2022, 5:19 p.m. | OK | MS C++ 2017 | TESTS | 16 | 327 | 7270400 | ||
162159567 | hxu10 | E | June 28, 2022, 5:36 p.m. | OK | PyPy 3 | TESTS | 16 | 233 | 25088000 | ||
162163376 | mintplz | E | June 28, 2022, 6:02 p.m. | OK | PyPy 3-64 | TESTS | 16 | 218 | 29900800 | ||
162159838 | duck702702 | E | June 28, 2022, 5:38 p.m. | OK | PyPy 3-64 | TESTS | 16 | 264 | 36147200 | ||
162171743 | Maruzensky | E | June 28, 2022, 7:27 p.m. | OK | PyPy 3-64 | TESTS | 16 | 280 | 35123200 | ||
162175589 | thewaxmango | E | June 28, 2022, 8:23 p.m. | OK | PyPy 3-64 | TESTS | 16 | 280 | 38502400 | ||
162161339 | avnyu | E | June 28, 2022, 5:48 p.m. | OK | PyPy 3-64 | TESTS | 16 | 296 | 41472000 | ||
162156597 | oadey89 | E | June 28, 2022, 5:20 p.m. | OK | PyPy 3-64 | TESTS | 16 | 358 | 38297600 | ||
162154213 | huangxw | E | June 28, 2022, 4:49 p.m. | OK | PyPy 3-64 | TESTS | 16 | 405 | 37990400 | ||
162161297 | avnyu | E | June 28, 2022, 5:48 p.m. | OK | Python 3 | TESTS | 16 | 545 | 29491200 | ||
162153628 | savsmail | E | June 28, 2022, 4:48 p.m. | OK | Python 3 | TESTS | 16 | 779 | 38604800 |
Back to search problems