Codeforces Round 789 (Div. 1)

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
1677 Codeforces Round 789 (Div. 1) FINISHED False 7200 92762687 May 8, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1329 ) D Tokitsukaze and Permutations PROGRAMMING dp math

B"Tokitsukaze has a permutation p . She performed the following operation to p exactly k times: in one operation, for each i from 1 to n - 1 in order, if p_i > p_{i+1} , swap p_i , p_{i+1} . After exactly k times of operations, Tokitsukaze got a new sequence a , obviously the sequence a is also a permutation. After that, Tokitsukaze wrote down the value sequence v of a on paper. Denote the value sequence v of the permutation a of length n as v_i= sum_{j=1}^{i-1}[a_i < a_j] , where the value of [a_i < a_j] define as if a_i < a_j , the value is 1 , otherwise is 0 (in other words, v_i is equal to the number of elements greater than a_i that are to the left of position i ). Then Tokitsukaze went out to work. There are three naughty cats in Tokitsukaze's house. When she came home, she found the paper with the value sequence v to be bitten out by the cats, leaving several holes, so that the value of some positions could not be seen clearly. She forgot what the original permutation p was. She wants to know how many different permutations p there are, so that the value sequence v of the new permutation a after exactly k operations is the same as the v written on the paper (not taking into account the unclear positions). Since the answer may be too large, print it modulo 998 ,244 ,353 . The first line contains a single integer t ( 1 <= q t <= q 1000 ) -- the number of test cases. Each test case consists of two lines. The first line contains two integers n and k ( 1 <= q n <= q 10^6 ; 0 <= q k <= q n-1 ) -- the length of the permutation and the exactly number of operations. The second line contains n integers v_1, v_2, ... , v_n ( -1 <= q v_i <= q i-1 ) -- the value sequence v . v_i = -1 means the i -th posit"...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
156337799 Gassa D May 8, 2022, 4:01 p.m. OK D TESTS 42 217 39731200
156328531 hos.lyric D May 8, 2022, 3:33 p.m. OK D TESTS 42 405 78438400
156370533 Jonothor_Darry D May 9, 2022, 12:13 a.m. OK GNU C++14 TESTS 45 156 0
156379262 A_normal_OIer D May 9, 2022, 4 a.m. OK GNU C++14 TESTS 45 202 3993600
156377669 HpSuda D May 9, 2022, 3:22 a.m. OK GNU C++14 TESTS 45 217 3993600
156372998 suyiheng D May 9, 2022, 1:40 a.m. OK GNU C++14 TESTS 45 218 3993600
156372505 chen_03 D May 9, 2022, 1:25 a.m. OK GNU C++14 TESTS 45 218 3993600
156371580 peiwenjun D May 9, 2022, 12:53 a.m. OK GNU C++14 TESTS 45 218 3993600
156369866 sbzhangjianjun D May 8, 2022, 11:46 p.m. OK GNU C++14 TESTS 45 218 4403200
156353104 liympanda D May 8, 2022, 5:40 p.m. OK GNU C++14 TESTS 44 218 4403200
156324696 feecIe6418 D May 8, 2022, 3:23 p.m. OK GNU C++14 TESTS 42 233 3993600
156352177 CoachDanke D May 8, 2022, 5:31 p.m. OK GNU C++14 TESTS 42 233 7987200
156373601 DerekFeng D May 9, 2022, 1:56 a.m. OK GNU C++17 TESTS 45 218 3993600
156373594 DerekFeng D May 9, 2022, 1:56 a.m. OK GNU C++17 TESTS 45 218 3993600
156371961 krit3379 D May 9, 2022, 1:07 a.m. OK GNU C++17 TESTS 45 218 3993600
156367090 YeXiaoRain D May 8, 2022, 10:01 p.m. OK GNU C++17 TESTS 45 233 3993600
156330233 xlk D May 8, 2022, 3:38 p.m. OK GNU C++17 TESTS 42 233 3993600
156337165 dantoh D May 8, 2022, 3:59 p.m. OK GNU C++17 TESTS 42 234 3993600
156335461 ppavic D May 8, 2022, 3:53 p.m. OK GNU C++17 TESTS 42 234 3993600
156333826 BilyHurington D May 8, 2022, 3:48 p.m. OK GNU C++17 TESTS 42 234 3993600
156332020 CandyBar D May 8, 2022, 3:43 p.m. OK GNU C++17 TESTS 42 234 3993600
156342988 frokaikan D May 8, 2022, 4:18 p.m. OK GNU C++17 TESTS 42 249 3993600
156330414 Juanzhang D May 8, 2022, 3:38 p.m. OK GNU C++17 (64) TESTS 42 31 6041600
156315911 ainta D May 8, 2022, 3:04 p.m. OK GNU C++17 (64) TESTS 42 46 12083200
156323976 QAQAutoMaton D May 8, 2022, 3:21 p.m. OK GNU C++17 (64) TESTS 42 46 32460800
156336533 LayCurse D May 8, 2022, 3:57 p.m. OK GNU C++17 (64) TESTS 42 46 102400000
156356652 skittles1412 D May 8, 2022, 6:22 p.m. OK GNU C++17 (64) TESTS 44 140 3993600
156355628 bashkort D May 8, 2022, 6:09 p.m. OK GNU C++17 (64) TESTS 44 140 3993600
156352039 natsugiri D May 8, 2022, 5:30 p.m. OK GNU C++17 (64) TESTS 42 140 3993600
156351738 Gom D May 8, 2022, 5:28 p.m. OK GNU C++17 (64) TESTS 42 140 3993600
156341792 Kude D May 8, 2022, 4:14 p.m. OK GNU C++17 (64) TESTS 42 140 3993600
156336508 est_stella D May 8, 2022, 3:57 p.m. OK GNU C++17 (64) TESTS 42 140 3993600
156370729 rsy D May 9, 2022, 12:21 a.m. OK GNU C++20 (64) TESTS 45 31 6041600
156348509 rsy D May 8, 2022, 4:34 p.m. OK GNU C++20 (64) TESTS 42 46 6041600
156342754 maspy D May 8, 2022, 4:17 p.m. OK GNU C++20 (64) TESTS 42 46 8089600
156332469 Linkus D May 8, 2022, 3:44 p.m. OK GNU C++20 (64) TESTS 42 93 3993600
156376041 fishcathu. D May 9, 2022, 2:43 a.m. OK GNU C++20 (64) TESTS 45 109 0
156351320 Egor.Lifar D May 8, 2022, 5:25 p.m. OK GNU C++20 (64) TESTS 42 109 7987200
156376187 izlyforever D May 9, 2022, 2:47 a.m. OK GNU C++20 (64) TESTS 45 124 3993600
156371982 HollwoQ_Pelw D May 9, 2022, 1:07 a.m. OK GNU C++20 (64) TESTS 45 124 3993600
156366658 fmota D May 8, 2022, 9:48 p.m. OK GNU C++20 (64) TESTS 45 124 3993600
156355741 AndreySergunin D May 8, 2022, 6:11 p.m. OK GNU C++20 (64) TESTS 44 124 3993600
156333900 arvindf232 D May 8, 2022, 3:48 p.m. OK Kotlin 1.4 TESTS 42 982 7577600
156341399 machine_solution D May 8, 2022, 4:13 p.m. OK MS C++ 2017 TESTS 42 748 16179200
156355391 whatshisbucket D May 8, 2022, 6:06 p.m. OK PyPy 3 TESTS 44 1435 182476800
156370294 siganai D May 9, 2022, 12:04 a.m. OK PyPy 3-64 TESTS 45 373 112435200
156345929 chinerist D May 8, 2022, 4:27 p.m. OK PyPy 3-64 TESTS 42 436 100249600
156333844 asdsasd D May 8, 2022, 3:48 p.m. OK PyPy 3-64 TESTS 42 826 127283200
156357489 Spheniscine D May 8, 2022, 6:34 p.m. OK Rust 2021 TESTS 44 93 4096000

remove filters

Back to search problems