Codeforces Round 917 (Div. 2)

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
1917 Codeforces Round 917 (Div. 2) FINISHED False 7200 28394699 Dec. 24, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1808 ) D Yet Another Inversions Problem PROGRAMMING bitmasks combinatorics data structures math

B"You are given a permutation p_0, p_1, ldots, p_{n-1} of odd integers from 1 to 2n-1 and a permutation q_0, q_1, ldots, q_{k-1} of integers from 0 to k-1 . An array a_0, a_1, ldots, a_{nk-1} of length nk is defined as follows: For example, if p = [3, 5, 1] and q = [0, 1] , then a = [3, 6, 5, 10, 1, 2] . Note that all arrays in the statement are zero-indexed. Note that each element of the array a is uniquely determined. Find the number of inversions in the array a . Since this number can be very large, you should find only its remainder modulo 998 ,244 ,353 . An inversion in array a is a pair (i, j) ( 0 <= i < j < nk ) such that a_i > a_j . The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The first line of each test case contains two integers n and k ( 1 <= n, k <= 2 cdot 10^5 ) -- the lengths of arrays p and q . The second line of each test case contains n distinct integers p_0, p_1, ldots, p_{n-1} ( 1 <= p_i <= 2n-1 , p_i is odd) -- the array p . The third line of each test case contains k distinct integers q_0, q_1, ldots, q_{k-1} ( 0 <= q_i < k ) -- the array q . It is guaranteed that the sum of n over all test cases doesn't exceed 2 cdot 10^5 and the sum of k over all test cases doesn't exceed 2 cdot 10^5 . For each test case, output one integer: the number of inversions in array a modulo 998 ,244 ,353 . In the first test case, array a is equal to [3, 6, 5, 10, 1, 2] . There are 9 inversions in it: (0, 4) , (0, 5) , (1, 2) , (1, 4) , (1, 5) , (2, 4) , (2, 5) , (3, 4) , (3, 5) . Note that these are pairs (i, j) such that i < j and a_i > a_j . In the second test case, array a is equal to ["...

Tutorials

Editorial of Codeforces Round 917 (Div. 2)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
238754550 Misha100896 D Dec. 24, 2023, 6:52 p.m. OK GNU C++14 TESTS 18 171 6656000
238780469 loutre D Dec. 25, 2023, 4:27 a.m. OK GNU C++14 TESTS 18 218 4300800
238745973 newone2023 D Dec. 24, 2023, 5:47 p.m. OK GNU C++14 TESTS 18 233 7782400
238746602 Alan.sp D Dec. 24, 2023, 5:50 p.m. OK GNU C++14 TESTS 18 233 35123200
238743704 wuhudsm D Dec. 24, 2023, 5:36 p.m. OK GNU C++14 TESTS 18 234 13107200
238744610 gigi.becali D Dec. 24, 2023, 5:40 p.m. OK GNU C++14 TESTS 18 249 7475200
238776558 omeganot D Dec. 25, 2023, 3:20 a.m. OK GNU C++14 TESTS 18 265 7475200
238774703 yd_tz D Dec. 25, 2023, 2:40 a.m. OK GNU C++14 TESTS 18 389 7884800
238772584 AFrAYuRmbrM D Dec. 25, 2023, 1:39 a.m. OK GNU C++14 TESTS 18 389 9113600
238777191 AFrAYuRmbrM D Dec. 25, 2023, 3:32 a.m. OK GNU C++14 TESTS 18 405 9113600
238773476 TrivialMan D Dec. 25, 2023, 2:09 a.m. OK GNU C++17 TESTS 18 155 9216000
238734457 tablemoon D Dec. 24, 2023, 4:26 p.m. OK GNU C++17 TESTS 18 171 26726400
238748409 Ronnie007 D Dec. 24, 2023, 6:01 p.m. OK GNU C++17 TESTS 18 202 5836800
238744161 liympanda D Dec. 24, 2023, 5:38 p.m. OK GNU C++17 TESTS 18 217 5120000
238747787 DinoHadzic D Dec. 24, 2023, 5:58 p.m. OK GNU C++17 TESTS 18 218 4300800
238784548 quangdepzai D Dec. 25, 2023, 5:19 a.m. OK GNU C++17 TESTS 18 234 5120000
238743631 Cai_Guang D Dec. 24, 2023, 5:36 p.m. OK GNU C++17 TESTS 18 234 5836800
238757867 Roll_Num_44 D Dec. 24, 2023, 7:34 p.m. OK GNU C++17 TESTS 18 264 10649600
238755629 FzArK D Dec. 24, 2023, 7:06 p.m. OK GNU C++17 TESTS 18 265 21094400
238783593 Ostrich888 D Dec. 25, 2023, 5:09 a.m. OK GNU C++17 TESTS 18 280 5017600
238778924 enslaved D Dec. 25, 2023, 4:03 a.m. OK GNU C++17 (64) TESTS 18 93 5222400
238732691 zouyu963l D Dec. 24, 2023, 4:21 p.m. OK GNU C++17 (64) TESTS 18 140 5427200
238761067 jz796 D Dec. 24, 2023, 8:20 p.m. OK GNU C++17 (64) TESTS 18 140 6041600
238788328 stability D Dec. 25, 2023, 5:58 a.m. OK GNU C++17 (64) TESTS 18 140 27340800
238737083 2018haha D Dec. 24, 2023, 4:32 p.m. OK GNU C++17 (64) TESTS 18 155 13312000
238762645 PurpleCrayon D Dec. 24, 2023, 8:45 p.m. OK GNU C++17 (64) TESTS 18 156 4505600
238775460 fs20091003 D Dec. 25, 2023, 2:57 a.m. OK GNU C++17 (64) TESTS 18 156 14848000
238745135 ahey D Dec. 24, 2023, 5:42 p.m. OK GNU C++17 (64) TESTS 18 171 39731200
238733702 bestzzz D Dec. 24, 2023, 4:24 p.m. OK GNU C++17 (64) TESTS 18 186 16486400
238774004 jackylova_fan_fan_fan D Dec. 25, 2023, 2:23 a.m. OK GNU C++17 (64) TESTS 18 187 5222400
238770181 cmk666 D Dec. 25, 2023, 12:09 a.m. OK GNU C++20 (64) TESTS 18 93 5017600
238786385 gugg D Dec. 25, 2023, 5:37 a.m. OK GNU C++20 (64) TESTS 18 93 5324800
238749752 codicon D Dec. 24, 2023, 6:10 p.m. OK GNU C++20 (64) TESTS 18 93 13312000
238748144 MasterPratyush D Dec. 24, 2023, 6 p.m. OK GNU C++20 (64) TESTS 18 108 7680000
238749468 zeemanz D Dec. 24, 2023, 6:08 p.m. OK GNU C++20 (64) TESTS 18 109 5324800
238750280 codicon D Dec. 24, 2023, 6:14 p.m. OK GNU C++20 (64) TESTS 18 109 13312000
238781564 woshi1uo D Dec. 25, 2023, 4:43 a.m. OK GNU C++20 (64) TESTS 18 124 5324800
238769140 Satinii D Dec. 24, 2023, 11:30 p.m. OK GNU C++20 (64) TESTS 18 124 5324800
238768028 abotaha23 D Dec. 24, 2023, 10:53 p.m. OK GNU C++20 (64) TESTS 18 124 5324800
238746620 FelixArg D Dec. 24, 2023, 5:50 p.m. OK GNU C++20 (64) TESTS 18 124 5324800
238738054 FierteDeCeylan D Dec. 24, 2023, 4:33 p.m. OK Java 17 TESTS 18 514 40448000
238756934 mcrash12 D Dec. 24, 2023, 7:22 p.m. OK Java 21 TESTS 18 420 46796800
238735781 arvindf232 D Dec. 24, 2023, 4:29 p.m. OK Kotlin 1.6 TESTS 18 483 24883200
238735179 Little_Sheep_Yawn D Dec. 24, 2023, 4:28 p.m. OK PyPy 3-64 TESTS 18 1045 69529600
238733563 yupooh D Dec. 24, 2023, 4:24 p.m. OK PyPy 3-64 TESTS 18 1153 55296000
238744247 ManojkumarPatanik D Dec. 24, 2023, 5:38 p.m. OK PyPy 3-64 TESTS 18 1154 61952000
238736072 Alex239 D Dec. 24, 2023, 4:29 p.m. OK PyPy 3-64 TESTS 18 1154 61952000
238734925 Shirotsume D Dec. 24, 2023, 4:27 p.m. OK PyPy 3-64 TESTS 18 1231 61747200
238788624 eepsilon D Dec. 25, 2023, 6:01 a.m. OK PyPy 3-64 TESTS 18 1387 60006400
238783778 skhan_org D Dec. 25, 2023, 5:11 a.m. OK PyPy 3-64 TESTS 18 1544 62771200
238742198 dirac_de D Dec. 24, 2023, 5:29 p.m. OK PyPy 3-64 TESTS 18 1638 94924800
238745002 aPNJ777 D Dec. 24, 2023, 5:41 p.m. OK PyPy 3-64 TESTS 18 1809 60108800

remove filters

Back to search problems