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 |
---|---|---|---|---|---|---|
1753 | Codeforces Round 829 (Div. 1) | FINISHED | False | 7200 | 65311799 | Oct. 23, 2022, 7:50 a.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 4558 ) | C | Wish I Knew How to Sort | PROGRAMMING | dp math probabilities | 2000 |
B"You are given a binary array a (all elements of the array are 0 or 1 ) of length n . You wish to sort this array, but unfortunately, your algorithms teacher forgot to teach you sorting algorithms. You perform the following operations until a is sorted: What is the expected number of such operations you will perform before the array becomes sorted? It can be shown that the answer can be expressed as an irreducible fraction frac{p}{q} , where p and q are integers and q not equiv 0 pmod{998 ,244 ,353} . Output the integer equal to p cdot q^{-1} bmod 998 ,244 ,353 . In other words, output such an integer x that 0 <= x < 998 ,244 ,353 and x cdot q equiv p pmod{998 ,244 ,353} . Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^5 ). Description of the test cases follows. The first line of each test case contains an integer n ( 1 <= n <= 200 ,000 ) -- the number of elements in the binary array. The second line of each test case contains n integers a_1, a_2, ldots, a_n ( a_i in {0, 1 } ) -- elements of the array. It's guaranteed that sum of n over all test cases does not exceed 200 ,000 . For each test case print one integer -- the value p cdot q^{-1} bmod 998 ,244 ,353 . Consider the first test case. If the pair of indices (2, 3) will be chosen, these elements will be swapped and array will become sorted. Otherwise, if one of pairs (1, 2) or (1, 3) will be selected, nothing will happen. So, the probability that the array will become sorted after one operation is frac{1}{3} , the probability that the array will become sorted after two operations is frac{2}{3} cdot frac{1}{3} , the probability that the array will become sorted after three operations is frac{2}{3} cdot frac{2}{3} cdot frac{1}{3} and so on. The expected numb"... |
Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
177706551 | mban259 | C | Oct. 24, 2022, 1:01 a.m. | OK | C# 10 | TESTS | 9 | 108 | 25702400 | 2000 | |
177577490 | Gassa | C | Oct. 23, 2022, 8:47 a.m. | OK | D | TESTS | 9 | 78 | 4198400 | 2000 | |
177559606 | hos.lyric | C | Oct. 23, 2022, 8:18 a.m. | OK | D | TESTS | 9 | 93 | 27443200 | 2000 | |
177646948 | CQYZWJH | C | Oct. 23, 2022, 1:07 p.m. | OK | GNU C++14 | TESTS | 9 | 31 | 1638400 | 2000 | |
177572944 | waaitg | C | Oct. 23, 2022, 8:39 a.m. | OK | GNU C++14 | TESTS | 9 | 31 | 1638400 | 2000 | |
177711830 | SSilhouettes | C | Oct. 24, 2022, 2:52 a.m. | OK | GNU C++14 | TESTS | 9 | 31 | 2457600 | 2000 | |
177573873 | Iridescent2020 | C | Oct. 23, 2022, 8:41 a.m. | OK | GNU C++14 | TESTS | 9 | 31 | 9216000 | 2000 | |
177573661 | enoamaoae | C | Oct. 23, 2022, 8:40 a.m. | OK | GNU C++14 | TESTS | 9 | 31 | 22323200 | 2000 | |
177654775 | rqoi031 | C | Oct. 23, 2022, 2:03 p.m. | OK | GNU C++14 | TESTS | 9 | 46 | 819200 | 2000 | |
177646821 | ez_lcw | C | Oct. 23, 2022, 1:06 p.m. | OK | GNU C++14 | TESTS | 9 | 46 | 819200 | 2000 | |
177588248 | RayLuo | C | Oct. 23, 2022, 9:10 a.m. | OK | GNU C++14 | TESTS | 9 | 46 | 819200 | 2000 | |
177578533 | themoon | C | Oct. 23, 2022, 8:49 a.m. | OK | GNU C++14 | TESTS | 9 | 46 | 819200 | 2000 | |
177572455 | PYD | C | Oct. 23, 2022, 8:38 a.m. | OK | GNU C++14 | TESTS | 9 | 46 | 819200 | 2000 | |
177595303 | zhaojinxi | C | Oct. 23, 2022, 9:27 a.m. | OK | GNU C++17 | TESTS | 9 | 31 | 8192000 | 2000 | |
177711198 | yaoxi | C | Oct. 24, 2022, 2:41 a.m. | OK | GNU C++17 | TESTS | 9 | 46 | 819200 | 2000 | |
177648795 | thehiddencorner | C | Oct. 23, 2022, 1:27 p.m. | OK | GNU C++17 | TESTS | 9 | 46 | 819200 | 2000 | |
177594001 | loveye | C | Oct. 23, 2022, 9:24 a.m. | OK | GNU C++17 | TESTS | 9 | 46 | 819200 | 2000 | |
177592850 | machhra | C | Oct. 23, 2022, 9:21 a.m. | OK | GNU C++17 | TESTS | 9 | 46 | 819200 | 2000 | |
177589553 | Amel | C | Oct. 23, 2022, 9:13 a.m. | OK | GNU C++17 | TESTS | 9 | 46 | 819200 | 2000 | |
177575706 | superguyjm | C | Oct. 23, 2022, 8:44 a.m. | OK | GNU C++17 | TESTS | 9 | 46 | 819200 | 2000 | |
177573765 | juju054 | C | Oct. 23, 2022, 8:40 a.m. | OK | GNU C++17 | TESTS | 9 | 46 | 819200 | 2000 | |
177573604 | howardyang | C | Oct. 23, 2022, 8:40 a.m. | OK | GNU C++17 | TESTS | 9 | 46 | 819200 | 2000 | |
177566440 | ybw051114 | C | Oct. 23, 2022, 8:28 a.m. | OK | GNU C++17 | TESTS | 9 | 46 | 819200 | 2000 | |
177573199 | Sol1 | C | Oct. 23, 2022, 8:39 a.m. | OK | GNU C++17 (64) | TESTS | 9 | 15 | 2867200 | 2000 | |
177709610 | CharlesWuQiushi | C | Oct. 24, 2022, 2:14 a.m. | OK | GNU C++17 (64) | TESTS | 9 | 30 | 1638400 | 2000 | |
177557883 | QAQAutoMaton | C | Oct. 23, 2022, 8:16 a.m. | OK | GNU C++17 (64) | TESTS | 9 | 30 | 6656000 | 2000 | |
177705765 | Lonely. | C | Oct. 24, 2022, 12:36 a.m. | OK | GNU C++17 (64) | TESTS | 9 | 31 | 819200 | 2000 | |
177686673 | znhy | C | Oct. 23, 2022, 6:44 p.m. | OK | GNU C++17 (64) | TESTS | 9 | 31 | 819200 | 2000 | |
177600393 | noya2 | C | Oct. 23, 2022, 9:39 a.m. | OK | GNU C++17 (64) | TESTS | 9 | 31 | 819200 | 2000 | |
177596148 | aymanriadsolh | C | Oct. 23, 2022, 9:29 a.m. | OK | GNU C++17 (64) | TESTS | 9 | 31 | 819200 | 2000 | |
177587905 | sotanishy | C | Oct. 23, 2022, 9:09 a.m. | OK | GNU C++17 (64) | TESTS | 9 | 31 | 819200 | 2000 | |
177584720 | nell_jwk | C | Oct. 23, 2022, 9:02 a.m. | OK | GNU C++17 (64) | TESTS | 9 | 31 | 819200 | 2000 | |
177579857 | cdbbla | C | Oct. 23, 2022, 8:52 a.m. | OK | GNU C++17 (64) | TESTS | 9 | 31 | 819200 | 2000 | |
177704376 | Rencj | C | Oct. 23, 2022, 11:54 p.m. | OK | GNU C++20 (64) | TESTS | 9 | 15 | 1638400 | 2000 | |
177704374 | OotoriEmu | C | Oct. 23, 2022, 11:54 p.m. | OK | GNU C++20 (64) | TESTS | 9 | 15 | 2867200 | 2000 | |
177552144 | Depth_First_Search | C | Oct. 23, 2022, 8:09 a.m. | OK | GNU C++20 (64) | TESTS | 9 | 30 | 2457600 | 2000 | |
177585289 | Hencecho | C | Oct. 23, 2022, 9:03 a.m. | OK | GNU C++20 (64) | TESTS | 9 | 30 | 136908800 | 2000 | |
177712603 | frozenca | C | Oct. 24, 2022, 3:06 a.m. | OK | GNU C++20 (64) | TESTS | 9 | 31 | 819200 | 2000 | |
177706601 | 02Yuchen | C | Oct. 24, 2022, 1:02 a.m. | OK | GNU C++20 (64) | TESTS | 9 | 31 | 819200 | 2000 | |
177706570 | Thallium54 | C | Oct. 24, 2022, 1:01 a.m. | OK | GNU C++20 (64) | TESTS | 9 | 31 | 819200 | 2000 | |
177706523 | 02Yuchen | C | Oct. 24, 2022, 1 a.m. | OK | GNU C++20 (64) | TESTS | 9 | 31 | 819200 | 2000 | |
177702456 | smax | C | Oct. 23, 2022, 10:50 p.m. | OK | GNU C++20 (64) | TESTS | 9 | 31 | 819200 | 2000 | |
177698380 | Egor.Lifar | C | Oct. 23, 2022, 9:03 p.m. | OK | GNU C++20 (64) | TESTS | 9 | 31 | 819200 | 2000 | |
177669702 | dusty.and.rusty | C | Oct. 23, 2022, 4 p.m. | OK | Java 17 | TESTS | 9 | 436 | 16588800 | 2000 | |
177583427 | fetetriste | C | Oct. 23, 2022, 8:59 a.m. | OK | Java 8 | TESTS | 9 | 202 | 0 | 2000 | |
177649345 | DarLam | C | Oct. 23, 2022, 1:30 p.m. | OK | Java 8 | TESTS | 9 | 405 | 0 | 2000 | |
177556863 | EduRoundOnly | C | Oct. 23, 2022, 8:15 a.m. | OK | Kotlin 1.6 | TESTS | 9 | 296 | 0 | 2000 | |
177591943 | ItamarNir | C | Oct. 23, 2022, 9:19 a.m. | OK | MS C++ 2017 | TESTS | 9 | 296 | 819200 | 2000 | |
177588024 | taekop | C | Oct. 23, 2022, 9:09 a.m. | OK | MS C++ 2017 | TESTS | 9 | 389 | 3993600 | 2000 | |
177579976 | bcollet | C | Oct. 23, 2022, 8:52 a.m. | OK | PyPy 2 | TESTS | 9 | 187 | 8396800 | 2000 | |
177587056 | tassei903 | C | Oct. 23, 2022, 9:07 a.m. | OK | PyPy 3 | TESTS | 9 | 296 | 12595200 | 2000 | |
177570265 | SPD_9X2 | C | Oct. 23, 2022, 8:34 a.m. | OK | PyPy 3 | TESTS | 9 | 545 | 42905600 | 2000 | |
177553445 | conqueror_of_tourist | C | Oct. 23, 2022, 8:11 a.m. | OK | PyPy 3-64 | TESTS | 9 | 109 | 27852800 | 2000 | |
177717056 | ktthree | C | Oct. 24, 2022, 4:27 a.m. | OK | PyPy 3-64 | TESTS | 9 | 124 | 22118400 | 2000 | |
177579902 | xxh1999 | C | Oct. 23, 2022, 8:52 a.m. | OK | PyPy 3-64 | TESTS | 9 | 140 | 20992000 | 2000 | |
177564705 | kyoran | C | Oct. 23, 2022, 8:26 a.m. | OK | PyPy 3-64 | TESTS | 9 | 186 | 22528000 | 2000 | |
177600797 | Maruzensky | C | Oct. 23, 2022, 9:40 a.m. | OK | PyPy 3-64 | TESTS | 9 | 186 | 22937600 | 2000 | |
177666066 | eepsilon | C | Oct. 23, 2022, 3:30 p.m. | OK | PyPy 3-64 | TESTS | 9 | 218 | 22835200 | 2000 | |
177579561 | Yawn_Sean | C | Oct. 23, 2022, 8:51 a.m. | OK | PyPy 3-64 | TESTS | 9 | 280 | 26931200 | 2000 | |
177593604 | szjlove | C | Oct. 23, 2022, 9:23 a.m. | OK | PyPy 3-64 | TESTS | 9 | 295 | 19865600 | 2000 | |
177578188 | titia | C | Oct. 23, 2022, 8:48 a.m. | OK | PyPy 3-64 | TESTS | 9 | 311 | 18739200 | 2000 | |
177597963 | toam | C | Oct. 23, 2022, 9:33 a.m. | OK | PyPy 3-64 | TESTS | 9 | 389 | 22835200 | 2000 | |
177578208 | Jimanbanashi | C | Oct. 23, 2022, 8:48 a.m. | OK | Python 2 | TESTS | 9 | 529 | 2662400 | 2000 | |
177672770 | roycf123 | C | Oct. 23, 2022, 4:27 p.m. | OK | Python 3 | TESTS | 9 | 607 | 3584000 | 2000 | |
177568288 | katand | C | Oct. 23, 2022, 8:31 a.m. | OK | Rust 2021 | TESTS | 9 | 31 | 18432000 | 2000 | |
177553717 | sansen | C | Oct. 23, 2022, 8:11 a.m. | OK | Rust 2021 | TESTS | 9 | 46 | 2662400 | 2000 |
Back to search problems