Codeforces Round 845 (Div. 2) and ByteRace 2023

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
1777 Codeforces Round 845 (Div. 2) and ByteRace 2023 FINISHED False 7200 57511499 Jan. 21, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 17613 ) B Emordnilap PROGRAMMING greedy math

B'A permutation of length n is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation ( 2 appears twice in the array), and [1,3,4] is also not a permutation ( n=3 but there is 4 in the array). There are n! = n cdot (n-1) cdot (n - 2) cdot ldots cdot 1 different permutations of length n . Given a permutation p of n numbers, we create an array a consisting of 2n numbers, which is equal to p concatenated with its reverse. We then define the beauty of p as the number of inversions in a . The number of inversions in the array a is the number of pairs of indices i , j such that i < j and a_i > a_j . For example, for permutation p = [1, 2] , a would be [1, 2, 2, 1] . The inversions in a are (2, 4) and (3, 4) (assuming 1-based indexing). Hence, the beauty of p is 2 . Your task is to find the sum of beauties of all n! permutations of size n . Print the remainder we get when dividing this value by 1 ,000 ,000 ,007 ( 10^9 + 7 ). Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^5 ). The description of the test cases follows. Each test case has only one line -- the integer n ( 1 <= q n <= q 10^5 ). It is guaranteed that the sum of n over all test cases does not exceed 10^5 . For each test case, print one integer -- the sum of beauties of all permutations of size n modulo 1 ,000 ,000 ,007 ( 10^9 + 7 ). For the first test case of the example, p = [1] is the only permutation. a = [1, 1] has 0 inversions. For the second test case of the example, the permutations are [1, 2] and [2, 1] . Their respective a arrays are [1, 2, 2, 1] a'...

Tutorials

Codeforces Round #845 (Div. 2) and ByteRace 2023 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
190024890 AndreyNaumov B Jan. 21, 2023, 4:34 p.m. OK C# 10 TESTS 19 62 409600
190038745 ansergeyg B Jan. 21, 2023, 7:28 p.m. OK C# 8 TESTS 19 93 512000
190038775 pratyushraghuvanshi73 B Jan. 21, 2023, 7:29 p.m. OK Clang++17 Diagnostics TESTS 19 124 819200
190034870 Moka50 B Jan. 21, 2023, 6:51 p.m. OK GNU C11 TESTS 19 31 0
190020319 Umnikfan B Jan. 21, 2023, 4:20 p.m. OK GNU C11 TESTS 19 31 16076800
190058081 G_Yuvrajsinh_4242 B Jan. 22, 2023, 4:32 a.m. OK GNU C11 TESTS 19 46 0
190035494 Umnikfan B Jan. 21, 2023, 6:55 p.m. OK GNU C11 TESTS 19 46 0
190035592 Umnikfan B Jan. 21, 2023, 6:56 p.m. OK GNU C11 TESTS 19 46 0
190036185 wackyIndian B Jan. 21, 2023, 7:01 p.m. OK GNU C11 TESTS 19 46 0
190036666 namanpahwa20 B Jan. 21, 2023, 7:06 p.m. OK GNU C11 TESTS 19 46 0
190058046 Interested B Jan. 22, 2023, 4:31 a.m. OK GNU C11 TESTS 19 46 0
190025299 p_2210040010 B Jan. 21, 2023, 4:34 p.m. OK GNU C11 TESTS 19 46 0
190035278 Umnikfan B Jan. 21, 2023, 6:53 p.m. OK GNU C11 TESTS 19 46 0
190059031 SadikMR B Jan. 22, 2023, 4:49 a.m. OK GNU C++14 TESTS 19 15 0
190058925 anisha1112 B Jan. 22, 2023, 4:47 a.m. OK GNU C++14 TESTS 19 15 0
190054753 wangxs B Jan. 22, 2023, 3:01 a.m. OK GNU C++14 TESTS 19 15 0
190056868 Prasanna_Jangali B Jan. 22, 2023, 4:01 a.m. OK GNU C++14 TESTS 19 15 0
190060441 Sneha12 B Jan. 22, 2023, 5:13 a.m. OK GNU C++14 TESTS 19 15 0
190060678 bajrangi07 B Jan. 22, 2023, 5:17 a.m. OK GNU C++14 TESTS 19 15 0
190062390 KaranGp_69 B Jan. 22, 2023, 5:42 a.m. OK GNU C++14 TESTS 19 15 0
190063169 leonardo_lunatic B Jan. 22, 2023, 5:52 a.m. OK GNU C++14 TESTS 19 15 0
190063335 chandler1837 B Jan. 22, 2023, 5:54 a.m. OK GNU C++14 TESTS 19 15 0
190063477 Babbar_606 B Jan. 22, 2023, 5:56 a.m. OK GNU C++14 TESTS 19 15 0
190055985 Glader_fan_fan B Jan. 22, 2023, 3:35 a.m. OK GNU C++17 TESTS 19 0 0
190042155 _Bond_007_ B Jan. 21, 2023, 8:17 p.m. OK GNU C++17 TESTS 19 0 0
190063518 __guts B Jan. 22, 2023, 5:57 a.m. OK GNU C++17 TESTS 19 15 0
190062710 Prajwalrayal B Jan. 22, 2023, 5:46 a.m. OK GNU C++17 TESTS 19 15 0
190063174 codeBegins B Jan. 22, 2023, 5:52 a.m. OK GNU C++17 TESTS 19 15 0
190061623 kyarakhubhai B Jan. 22, 2023, 5:31 a.m. OK GNU C++17 TESTS 19 15 0
190062095 vdmondkr B Jan. 22, 2023, 5:37 a.m. OK GNU C++17 TESTS 19 15 0
190062205 Akshitha.b06 B Jan. 22, 2023, 5:39 a.m. OK GNU C++17 TESTS 19 15 0
190062227 Me_hab_skill_issue B Jan. 22, 2023, 5:39 a.m. OK GNU C++17 TESTS 19 15 0
190062521 I_m_m_o_r_t_a_l B Jan. 22, 2023, 5:43 a.m. OK GNU C++17 TESTS 19 15 0
190035135 MWarith B Jan. 21, 2023, 6:52 p.m. OK GNU C++17 (64) TESTS 19 0 0
190063450 0822 B Jan. 22, 2023, 5:56 a.m. OK GNU C++17 (64) TESTS 19 0 4812800
190041716 lastcode78 B Jan. 21, 2023, 8:09 p.m. OK GNU C++17 (64) TESTS 19 15 0
190057987 cosinechicken B Jan. 22, 2023, 4:30 a.m. OK GNU C++17 (64) TESTS 19 15 0
190055144 Oinng B Jan. 22, 2023, 3:11 a.m. OK GNU C++17 (64) TESTS 19 15 0
190054049 nicky_ B Jan. 22, 2023, 2:31 a.m. OK GNU C++17 (64) TESTS 19 15 0
190052203 Hytidel B Jan. 22, 2023, 1:23 a.m. OK GNU C++17 (64) TESTS 19 15 0
190051519 Huntik_03 B Jan. 22, 2023, 12:50 a.m. OK GNU C++17 (64) TESTS 19 15 0
190051272 luanmenglei B Jan. 22, 2023, 12:41 a.m. OK GNU C++17 (64) TESTS 19 15 0
190042302 mesbah19 B Jan. 21, 2023, 8:20 p.m. OK GNU C++17 (64) TESTS 19 15 0
190044363 utkarsh_tech B Jan. 21, 2023, 8:57 p.m. OK GNU C++20 (64) TESTS 19 0 0
190045014 Hamdy_Salem B Jan. 21, 2023, 9:10 p.m. OK GNU C++20 (64) TESTS 19 0 0
190046308 AnasMaged B Jan. 21, 2023, 9:39 p.m. OK GNU C++20 (64) TESTS 19 0 0
190057154 ayush.604 B Jan. 22, 2023, 4:09 a.m. OK GNU C++20 (64) TESTS 19 0 0
190058281 smgr B Jan. 22, 2023, 4:36 a.m. OK GNU C++20 (64) TESTS 19 0 0
190058533 Asamai B Jan. 22, 2023, 4:40 a.m. OK GNU C++20 (64) TESTS 19 0 0
190060133 Menos B Jan. 22, 2023, 5:08 a.m. OK GNU C++20 (64) TESTS 19 0 0
190060279 Only_Y B Jan. 22, 2023, 5:11 a.m. OK GNU C++20 (64) TESTS 19 0 0
190060475 kk110011 B Jan. 22, 2023, 5:14 a.m. OK GNU C++20 (64) TESTS 19 0 0
190061604 Ra_Mid B Jan. 22, 2023, 5:30 a.m. OK GNU C++20 (64) TESTS 19 0 0
190051838 surya03 B Jan. 22, 2023, 1:05 a.m. OK Java 11 TESTS 19 155 0
190040019 vijender_8601 B Jan. 21, 2023, 7:45 p.m. OK Java 11 TESTS 19 156 0
190038878 hecks B Jan. 21, 2023, 7:30 p.m. OK Java 11 TESTS 19 171 0
190058544 Bucky_ B Jan. 22, 2023, 4:40 a.m. OK Java 11 TESTS 19 218 0
190015412 bharathiraj B Jan. 21, 2023, 4:03 p.m. OK Java 11 TESTS 19 218 0
190058522 Bucky_ B Jan. 22, 2023, 4:40 a.m. OK Java 11 TESTS 19 233 0
190063056 gk_cool B Jan. 22, 2023, 5:51 a.m. OK Java 11 TESTS 19 249 0
190063382 yogesg_25 B Jan. 22, 2023, 5:55 a.m. OK Java 11 TESTS 19 264 0
190017788 smitpadshala99 B Jan. 21, 2023, 4:11 p.m. OK Java 11 TESTS 19 265 0
190059611 prashant62 B Jan. 22, 2023, 5 a.m. OK Java 11 TESTS 19 280 0
190042237 Danger_Don B Jan. 21, 2023, 8:19 p.m. OK Java 17 TESTS 19 186 921600
190013950 cosefordes B Jan. 21, 2023, 3:58 p.m. OK Java 17 TESTS 19 187 0
190021809 shubhanshu_jha14 B Jan. 21, 2023, 4:25 p.m. OK Java 17 TESTS 19 187 409600
190063163 Thejas_n B Jan. 22, 2023, 5:52 a.m. OK Java 17 TESTS 19 187 819200
190018356 Badass_Nemesis B Jan. 21, 2023, 4:13 p.m. OK Java 17 TESTS 19 187 7270400
190012077 Sudh9039 B Jan. 21, 2023, 3:52 p.m. OK Java 17 TESTS 19 202 204800
190037140 Mustela_Erminea B Jan. 21, 2023, 7:11 p.m. OK Java 17 TESTS 19 202 307200
190022248 PrudhviRao15 B Jan. 21, 2023, 4:26 p.m. OK Java 17 TESTS 19 218 307200
190035105 not_just_rr B Jan. 21, 2023, 6:52 p.m. OK Java 17 TESTS 19 233 0
190015124 d2s2 B Jan. 21, 2023, 4:02 p.m. OK Java 17 TESTS 19 233 307200
190036899 Swapniltri B Jan. 21, 2023, 7:09 p.m. OK Java 8 TESTS 19 93 0
190036245 jkslyk B Jan. 21, 2023, 7:02 p.m. OK Java 8 TESTS 19 93 0
190038253 DylanSmith B Jan. 21, 2023, 7:23 p.m. OK Java 8 TESTS 19 109 0
190037243 yadavDipesh B Jan. 21, 2023, 7:12 p.m. OK Java 8 TESTS 19 109 0
190022842 DStavi B Jan. 21, 2023, 4:28 p.m. OK Java 8 TESTS 19 155 0
190012772 _Clf B Jan. 21, 2023, 3:54 p.m. OK Java 8 TESTS 19 156 0
190052145 mohamedhassan_c B Jan. 22, 2023, 1:20 a.m. OK Java 8 TESTS 19 156 0
190023018 Tanvir2000 B Jan. 21, 2023, 4:29 p.m. OK Java 8 TESTS 19 187 0
190020181 sravanchaitanya B Jan. 21, 2023, 4:19 p.m. OK Java 8 TESTS 19 202 0
190044991 zviad_nemsadze B Jan. 21, 2023, 9:10 p.m. OK Java 8 TESTS 19 202 0
190014445 Gamboa B Jan. 21, 2023, 4 p.m. OK JavaScript TESTS 19 31 2150400
190041710 maxK99 B Jan. 21, 2023, 8:09 p.m. OK MS C++ 2017 TESTS 19 15 0
190025272 _.prateek._.singh._ B Jan. 21, 2023, 4:34 p.m. OK MS C++ 2017 TESTS 19 31 0
190013003 Gadi B Jan. 21, 2023, 3:55 p.m. OK MS C++ 2017 TESTS 19 31 819200
190021288 sinha_abhinav153 B Jan. 21, 2023, 4:23 p.m. OK MS C++ 2017 TESTS 19 46 0
190018023 Divyam_1 B Jan. 21, 2023, 4:12 p.m. OK MS C++ 2017 TESTS 19 46 0
190040757 shorya1835 B Jan. 21, 2023, 7:55 p.m. OK MS C++ 2017 TESTS 19 62 0
190022557 aswer03 B Jan. 21, 2023, 4:27 p.m. OK MS C++ 2017 TESTS 19 62 1638400
190019673 beksultanomirzak.2001 B Jan. 21, 2023, 4:18 p.m. OK Node.js TESTS 19 170 5017600
190011796 rejep001 B Jan. 21, 2023, 3:51 p.m. OK PascalABC.NET TESTS 19 295 1536000
190062355 codin.vaishnav B Jan. 22, 2023, 5:41 a.m. OK PHP TESTS 19 46 8396800
190015086 tsarprince B Jan. 21, 2023, 4:02 p.m. OK PyPy 2 TESTS 19 576 8806400
190056725 hkwu6013 B Jan. 22, 2023, 3:57 a.m. OK PyPy 3 TESTS 19 124 3276800
190051626 Track-Days B Jan. 22, 2023, 12:55 a.m. OK PyPy 3 TESTS 19 124 10547200
190014236 Abdalkhalig B Jan. 21, 2023, 3:59 p.m. OK PyPy 3 TESTS 19 155 5632000
190018098 Sai_Chatur B Jan. 21, 2023, 4:12 p.m. OK PyPy 3 TESTS 19 233 3788800
190035013 Mr_Turtle_ B Jan. 21, 2023, 6:52 p.m. OK PyPy 3 TESTS 19 233 3993600
190058472 sorcerer_21 B Jan. 22, 2023, 4:39 a.m. OK PyPy 3 TESTS 19 264 5017600
190053342 tahm_id B Jan. 22, 2023, 2:03 a.m. OK PyPy 3 TESTS 19 264 6451200
190022419 marti2357 B Jan. 21, 2023, 4:27 p.m. OK PyPy 3 TESTS 19 264 7168000
190046139 LazyRGuy B Jan. 21, 2023, 9:35 p.m. OK PyPy 3 TESTS 19 280 6246400
190022976 Recurser B Jan. 21, 2023, 4:28 p.m. OK PyPy 3 TESTS 19 280 6758400
190057176 rishabh26072003 B Jan. 22, 2023, 4:10 a.m. OK PyPy 3-64 TESTS 19 62 4198400
190038132 Triump_0112 B Jan. 21, 2023, 7:22 p.m. OK PyPy 3-64 TESTS 19 77 2457600
190056399 Youarenotgood B Jan. 22, 2023, 3:47 a.m. OK PyPy 3-64 TESTS 19 77 4198400
190057202 MenaceJn B Jan. 22, 2023, 4:11 a.m. OK PyPy 3-64 TESTS 19 77 7577600
190036620 sushmanth.dampur8780 B Jan. 21, 2023, 7:06 p.m. OK PyPy 3-64 TESTS 19 77 8192000
190037356 aayush_chhabra B Jan. 21, 2023, 7:13 p.m. OK PyPy 3-64 TESTS 19 93 5836800
190020974 iN_siDious B Jan. 21, 2023, 4:22 p.m. OK PyPy 3-64 TESTS 19 124 8192000
190060147 Sriram_Bharadwaj B Jan. 22, 2023, 5:08 a.m. OK PyPy 3-64 TESTS 19 139 4505600
190015541 Trickster_ B Jan. 21, 2023, 4:03 p.m. OK PyPy 3-64 TESTS 19 140 7987200
190035633 Uranium_238 B Jan. 21, 2023, 6:56 p.m. OK PyPy 3-64 TESTS 19 155 4403200
190014185 ipriyam26 B Jan. 21, 2023, 3:59 p.m. OK Python 3 TESTS 19 93 2355200
190017957 gustavoo B Jan. 21, 2023, 4:12 p.m. OK Python 3 TESTS 19 108 0
190020572 JustTheory B Jan. 21, 2023, 4:21 p.m. OK Python 3 TESTS 19 109 0
190054823 williamcz B Jan. 22, 2023, 3:03 a.m. OK Python 3 TESTS 19 124 0
190045441 20cs3045 B Jan. 21, 2023, 9:20 p.m. OK Python 3 TESTS 19 124 0
190045349 20cs3045 B Jan. 21, 2023, 9:18 p.m. OK Python 3 TESTS 19 124 0
190036606 cody_anna B Jan. 21, 2023, 7:05 p.m. OK Python 3 TESTS 19 124 0
190024119 panpaliaram B Jan. 21, 2023, 4:32 p.m. OK Python 3 TESTS 19 124 0
190018302 jen4jain B Jan. 21, 2023, 4:13 p.m. OK Python 3 TESTS 19 124 0
190018100 Hanle B Jan. 21, 2023, 4:12 p.m. OK Python 3 TESTS 19 124 0
190022023 binayak1201 B Jan. 21, 2023, 4:25 p.m. OK Ruby 3 TESTS 19 249 204800
190048122 liut B Jan. 21, 2023, 10:30 p.m. OK Rust 2021 TESTS 19 15 0
190012696 aadi58002 B Jan. 21, 2023, 3:54 p.m. OK Rust 2021 TESTS 19 15 12800000
190046178 dmenezes B Jan. 21, 2023, 9:36 p.m. OK Rust 2021 TESTS 19 62 0
190060613 D4nnyLee B Jan. 22, 2023, 5:16 a.m. OK Rust 2021 TESTS 19 77 2150400
190060797 D4nnyLee B Jan. 22, 2023, 5:19 a.m. OK Rust 2021 TESTS 19 93 0
190060686 D4nnyLee B Jan. 22, 2023, 5:17 a.m. OK Rust 2021 TESTS 19 93 0

remove filters

Back to search problems