Educational Codeforces Round 57 (Rated for 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
1096 Educational Codeforces Round 57 (Rated for Div. 2) FINISHED False 7200 185815499 Dec. 28, 2018, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1810 ) F Inversion Expectation PROGRAMMING dp math probabilities 2300

B'A permutation of size n is an array of size n such that each integer from 1 to n occurs exactly once in this array. An inversion in a permutation p is a pair of indices (i, j) such that i > j and a_i < a_j . For example, a permutation [4, 1, 3, 2] contains 4 inversions: (2, 1) , (3, 1) , (4, 1) , (4, 3) . You are given a permutation p of size n . However, the numbers on some positions are replaced by -1 . Let the valid permutation be such a replacement of -1 in this sequence back to numbers from 1 to n in such a way that the resulting sequence is a permutation of size n . The given sequence was turned into a valid permutation randomly with the equal probability of getting each valid permutation. Calculate the expected total number of inversions in the resulting valid permutation. It can be shown that it is in the form of frac{P}{Q} where P and Q are non-negative integers and Q ne 0 . Report the value of P cdot Q^{-1} pmod {998244353} . The first line contains a single integer n ( 1 <= n <= 2 cdot 10^5 ) -- the length of the sequence. The second line contains n integers p_1, p_2, ... , p_n ( -1 <= p_i <= n , p_i ne 0 ) -- the initial sequence. It is guaranteed that all elements not equal to -1 are pairwise distinct. Print a single integer -- the expected total number of inversions in the resulting valid permutation. It can be shown that it is in the form of frac{P}{Q} where P and Q are non-negative integers and Q ne 0 . Report the value of P cdot Q^{-1} pmod {998244353} . In the first example two resulting valid permutations are possible: The expected value is frac{2 cdot 1 + 3 cdot 1}{2} = 2.5 . In the second example no -1 are present, thus the only valid permutation is possible -- the given one. It has 0 inver'...

Tutorials

Разбор Educational Codeforces Round 57

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
47661486 georgerapeanu F Dec. 28, 2018, 7:18 p.m. OK Clang++17 Diagnostics TESTS 32 857 3276800 2300
55413661 sansen F June 10, 2019, 10:56 p.m. OK GNU C11 TESTS 32 46 1638400 2300
48463121 rainboy F Jan. 16, 2019, 3:46 p.m. OK GNU C11 TESTS 32 62 3993600 2300
47653182 sansen F Dec. 28, 2018, 4:28 p.m. OK GNU C11 TESTS 32 93 14233600 2300
47711147 qqvq F Dec. 30, 2018, 3:36 a.m. OK GNU C++11 TESTS 32 31 5017600 2300
52084331 Cyhlnj F March 31, 2019, 1:38 p.m. OK GNU C++11 TESTS 32 31 6656000 2300
52560400 luogu_bot1 F April 10, 2019, 10:02 a.m. OK GNU C++11 TESTS 32 46 1433600 2300
47725500 luogu_bot1 F Dec. 30, 2018, 2 p.m. OK GNU C++11 TESTS 32 46 1433600 2300
47779560 memset_inf F Dec. 31, 2018, 7:07 a.m. OK GNU C++11 TESTS 32 46 1843200 2300
47779552 2735353930 F Dec. 31, 2018, 7:07 a.m. OK GNU C++11 TESTS 32 46 1843200 2300
47654058 xay5421 F Dec. 28, 2018, 4:32 p.m. OK GNU C++11 TESTS 32 46 2457600 2300
47961375 YoungNeal F Jan. 5, 2019, 9:30 a.m. OK GNU C++11 TESTS 32 46 2457600 2300
47775389 zhou2003 F Dec. 31, 2018, 3:15 a.m. OK GNU C++11 TESTS 32 46 2457600 2300
59820532 EncodeTalker F Aug. 31, 2019, 5:09 p.m. OK GNU C++11 TESTS 32 46 2457600 2300
56510693 bluefi F July 4, 2019, 10:13 a.m. OK GNU C++14 TESTS 32 62 1843200 2300
47671424 mjhun F Dec. 29, 2018, 6:17 a.m. OK GNU C++14 TESTS 32 77 2457600 2300
47776276 srikkanthr F Dec. 31, 2018, 4:10 a.m. OK GNU C++14 TESTS 32 77 2457600 2300
47703351 neal F Dec. 29, 2018, 6:20 p.m. OK GNU C++14 TESTS 32 77 2662400 2300
47653509 fshp971 F Dec. 28, 2018, 4:30 p.m. OK GNU C++14 TESTS 32 77 3993600 2300
48000081 kurarrr F Jan. 5, 2019, 6 p.m. OK GNU C++14 TESTS 32 77 3993600 2300
47654774 fshp971 F Dec. 28, 2018, 4:34 p.m. OK GNU C++14 TESTS 32 77 3993600 2300
47862191 shoemakerjo F Jan. 3, 2019, 6:59 a.m. OK GNU C++14 TESTS 32 77 4198400 2300
47721984 rawatds F Dec. 30, 2018, 11:54 a.m. OK GNU C++14 TESTS 32 77 4300800 2300
63951293 compiler_101 F Oct. 31, 2019, 9:30 p.m. OK GNU C++14 TESTS 32 77 5017600 2300
47643525 user202729_ F Dec. 28, 2018, 3:38 p.m. OK GNU C++17 TESTS 32 62 2662400 2300
47656750 OMG_wc F Dec. 28, 2018, 5:03 p.m. OK GNU C++17 TESTS 32 77 2457600 2300
47675427 Asagami F Dec. 29, 2018, 8:49 a.m. OK GNU C++17 TESTS 32 77 2560000 2300
47650571 littleju F Dec. 28, 2018, 4:15 p.m. OK GNU C++17 TESTS 32 77 2662400 2300
47879435 SheepRanger F Jan. 3, 2019, 5:25 p.m. OK GNU C++17 TESTS 32 77 4300800 2300
49475516 another_strike F Feb. 4, 2019, 7:12 p.m. OK GNU C++17 TESTS 32 77 15360000 2300
54264817 frteen F May 17, 2019, 5:10 a.m. OK GNU C++17 TESTS 32 78 2457600 2300
47662196 gogairemashvili F Dec. 28, 2018, 7:47 p.m. OK GNU C++17 TESTS 32 78 2457600 2300
47675214 qiu1 F Dec. 29, 2018, 8:42 a.m. OK GNU C++17 TESTS 32 78 2457600 2300
47824498 Nugi F Jan. 1, 2019, 8:44 p.m. OK GNU C++17 TESTS 32 78 2662400 2300
49239468 xodiac F Jan. 31, 2019, 9:35 a.m. OK Java 8 TESTS 32 139 0 2300
47702823 BaZ_ F Dec. 29, 2018, 5:56 p.m. OK Java 8 TESTS 32 155 3891200 2300
47702733 BaZ_ F Dec. 29, 2018, 5:52 p.m. OK Java 8 TESTS 32 156 3891200 2300
57872929 beginner1010 F July 28, 2019, 3:11 a.m. OK Java 8 TESTS 32 156 5222400 2300
47716373 Morgan_Y F Dec. 30, 2018, 8:02 a.m. OK Java 8 TESTS 32 171 2252800 2300
47655659 Yugioh F Dec. 28, 2018, 4:46 p.m. OK Java 8 TESTS 32 187 3276800 2300
47721957 boltUsain F Dec. 30, 2018, 11:53 a.m. OK Java 8 TESTS 32 202 6041600 2300
47648102 uwi F Dec. 28, 2018, 4:01 p.m. OK Java 8 TESTS 32 217 0 2300
48464326 Dukkha F Jan. 16, 2019, 4:25 p.m. OK Java 8 TESTS 32 280 2969600 2300
59175482 7dan F Aug. 20, 2019, 4:09 p.m. OK Java 8 TESTS 32 327 10956800 2300
47703355 schoenus F Dec. 29, 2018, 6:20 p.m. OK Mono C# TESTS 32 156 94003200 2300
47962764 omikad F Jan. 5, 2019, 10:23 a.m. OK Mono C# TESTS 32 171 33587200 2300
49398082 vjudge3 F Feb. 3, 2019, 1:21 p.m. OK MS C++ TESTS 32 124 12390400 2300
47684678 TiwAirOAO F Dec. 29, 2018, 2:05 p.m. OK MS C++ TESTS 32 312 2662400 2300
48084887 vjudge1 F Jan. 8, 2019, 10:35 a.m. OK MS C++ TESTS 32 312 2662400 2300
59619599 siwei F Aug. 28, 2019, 1:49 p.m. OK MS C++ 2017 TESTS 32 187 4198400 2300
62434859 YESMAths F Oct. 12, 2019, 5:01 p.m. OK PyPy 2 TESTS 32 280 16793600 2300
47881302 c1729 F Jan. 3, 2019, 6:30 p.m. OK PyPy 2 TESTS 32 280 18432000 2300
47683349 Jonte_98 F Dec. 29, 2018, 1:17 p.m. OK PyPy 2 TESTS 32 841 39424000 2300
47655270 kal013 F Dec. 28, 2018, 4:41 p.m. OK PyPy 2 TESTS 32 857 13004800 2300
47880621 c1729 F Jan. 3, 2019, 6:07 p.m. OK PyPy 2 TESTS 32 967 22528000 2300
47880976 c1729 F Jan. 3, 2019, 6:19 p.m. OK PyPy 2 TESTS 32 982 22528000 2300
47667126 cuom1999 F Dec. 29, 2018, 2 a.m. OK PyPy 3 TESTS 32 326 19251200 2300
47881358 c1729 F Jan. 3, 2019, 6:32 p.m. OK PyPy 3 TESTS 32 358 20992000 2300
61556507 Umi F Sept. 30, 2019, 2:12 p.m. OK PyPy 3 TESTS 32 374 23040000 2300
47659999 Guendabiaani F Dec. 28, 2018, 6:28 p.m. OK PyPy 3 TESTS 32 561 29388800 2300
47663626 titia F Dec. 28, 2018, 9:05 p.m. OK PyPy 3 TESTS 32 794 22425600 2300
47881096 c1729 F Jan. 3, 2019, 6:23 p.m. OK PyPy 3 TESTS 32 1045 25907200 2300
47881344 c1729 F Jan. 3, 2019, 6:32 p.m. OK Python 2 TESTS 32 1560 13516800 2300
47705304 whatshisbucket F Dec. 29, 2018, 7:48 p.m. OK Python 3 TESTS 32 1856 14336000 2300
47648938 kobae964 F Dec. 28, 2018, 4:06 p.m. OK Rust TESTS 32 342 6144000 2300

remove filters

Back to search problems