Codeforces Round 921 (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
1925 Codeforces Round 921 (Div. 2) FINISHED False 7200 30813263 Jan. 27, 2024, 2:45 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 3781 ) D Good Trip PROGRAMMING combinatorics dp math probabilities

B'There are n children in a class, m pairs among them are friends. The i -th pair who are friends have a friendship value of f_i . The teacher has to go for k excursions, and for each of the excursions she chooses a pair of children randomly, equiprobably and independently. If a pair of children who are friends is chosen, their friendship value increases by 1 for all subsequent excursions (the teacher can choose a pair of children more than once). The friendship value of a pair who are not friends is considered 0 , and it does not change for subsequent excursions. Find the expected value of the sum of friendship values of all k pairs chosen for the excursions (at the time of being chosen). It can be shown that this answer can always be expressed as a fraction dfrac{p}{q} where p and q are coprime integers. Calculate p cdot q^{-1} bmod (10^9+7) . Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 5 cdot 10^4 ). Description of the test cases follows. The first line of each test case contains 3 integers n , m and k ( 2 <= n <= 10^5 , 0 <= m <= min Big(10^5 , frac{n(n-1)}{2} Big) , 1 <= k <= 2 cdot 10^5 ) -- the number of children, pairs of friends and excursions respectively. The next m lines contain three integers each -- a_i , b_i , f_i -- the indices of the pair of children who are friends and their friendship value. ( a_i neq b_i , 1 <= a_i,b_i <= n , 1 <= f_i <= 10^9 ). It is guaranteed that all pairs of friends are distinct. It is guaranteed that the sum of n and sum m over all test cases does not exceed 10^5 and the sum of k over all test cases does not exceed 2 cdot 10^5 . For each test case, print one integer -- the answer to the problem. For the first test case, there are no pairs of friend'...

Tutorials

Codeforces Round 921 (Div. 1, Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
243709838 SIMON826 D Jan. 28, 2024, 5:18 a.m. OK GNU C++17 TESTS 18 78 0
243703347 Actium D Jan. 28, 2024, 3:54 a.m. OK GNU C++17 TESTS 18 78 409600
243688650 matislu D Jan. 27, 2024, 11:04 p.m. OK GNU C++17 TESTS 18 92 0
243712286 Syrius D Jan. 28, 2024, 5:43 a.m. OK GNU C++17 TESTS 18 93 0
243708880 larsr D Jan. 28, 2024, 5:07 a.m. OK GNU C++17 TESTS 18 93 0
243708357 shlokkzz D Jan. 28, 2024, 5:01 a.m. OK GNU C++17 TESTS 18 93 0
243705707 Hurrikale D Jan. 28, 2024, 4:27 a.m. OK GNU C++17 TESTS 18 93 0
243696081 Xiaozzz D Jan. 28, 2024, 2:05 a.m. OK GNU C++17 TESTS 18 93 0
243694274 piyush_beegala D Jan. 28, 2024, 1:31 a.m. OK GNU C++17 TESTS 18 93 0
243690724 Termii D Jan. 27, 2024, 11:55 p.m. OK GNU C++17 TESTS 18 93 0
243707022 xu826281112 D Jan. 28, 2024, 4:45 a.m. OK GNU C++17 (64) TESTS 18 31 4198400
243704155 lonelywolf. D Jan. 28, 2024, 4:06 a.m. OK GNU C++17 (64) TESTS 18 46 0
243703375 ereoth D Jan. 28, 2024, 3:55 a.m. OK GNU C++17 (64) TESTS 18 46 0
243702384 lonelywolf. D Jan. 28, 2024, 3:40 a.m. OK GNU C++17 (64) TESTS 18 46 0
243694243 idegas357 D Jan. 28, 2024, 1:31 a.m. OK GNU C++17 (64) TESTS 18 46 0
243710745 SkySummer D Jan. 28, 2024, 5:28 a.m. OK GNU C++17 (64) TESTS 18 61 7987200
243709226 21cs01033 D Jan. 28, 2024, 5:11 a.m. OK GNU C++17 (64) TESTS 18 62 0
243666373 abab1729 D Jan. 27, 2024, 6:51 p.m. OK GNU C++17 (64) TESTS 18 62 0
243654665 daud04 D Jan. 27, 2024, 4:42 p.m. OK GNU C++17 (64) TESTS 18 62 0
243680679 ocelo7 D Jan. 27, 2024, 8:51 p.m. OK GNU C++17 (64) TESTS 18 62 5632000
243713613 Ngeces D Jan. 28, 2024, 5:56 a.m. OK GNU C++20 (64) TESTS 18 46 0
243712378 mohammedkhalid D Jan. 28, 2024, 5:44 a.m. OK GNU C++20 (64) TESTS 18 46 0
243712215 crzy22 D Jan. 28, 2024, 5:42 a.m. OK GNU C++20 (64) TESTS 18 46 0
243704677 Belief_yfly D Jan. 28, 2024, 4:13 a.m. OK GNU C++20 (64) TESTS 18 46 0
243703634 tramp3 D Jan. 28, 2024, 3:58 a.m. OK GNU C++20 (64) TESTS 18 46 0
243702780 dark_ethics D Jan. 28, 2024, 3:46 a.m. OK GNU C++20 (64) TESTS 18 46 0
243701188 Hao_pp D Jan. 28, 2024, 3:25 a.m. OK GNU C++20 (64) TESTS 18 46 0
243701177 Hao_pp2 D Jan. 28, 2024, 3:25 a.m. OK GNU C++20 (64) TESTS 18 46 0
243698453 qfl_zzz D Jan. 28, 2024, 2:44 a.m. OK GNU C++20 (64) TESTS 18 46 0
243696333 pora D Jan. 28, 2024, 2:09 a.m. OK GNU C++20 (64) TESTS 18 46 0
243669313 mlangc D Jan. 27, 2024, 7:11 p.m. OK Java 21 TESTS 18 342 409600
243664848 pavan.nagaraju94 D Jan. 27, 2024, 6:43 p.m. OK Java 21 TESTS 18 389 409600
243678063 tushar19280 D Jan. 27, 2024, 8:23 p.m. OK Java 21 TESTS 18 405 40448000
243689872 28leoleo28 D Jan. 27, 2024, 11:33 p.m. OK Java 21 TESTS 18 436 5120000
243695112 sagbis D Jan. 28, 2024, 1:47 a.m. OK Java 21 TESTS 18 467 0
243678007 invincible777 D Jan. 27, 2024, 8:23 p.m. OK Java 8 TESTS 18 374 0
243675774 invincible777 D Jan. 27, 2024, 8:01 p.m. OK Java 8 TESTS 18 405 0
243693735 amaturecoder D Jan. 28, 2024, 1:19 a.m. OK Java 8 TESTS 18 530 0
243667980 vatsal_04 D Jan. 27, 2024, 7 p.m. OK Java 8 TESTS 18 733 0
243690052 RobinFromTheHood D Jan. 27, 2024, 11:38 p.m. OK PyPy 3-64 TESTS 18 155 9625600
243664781 a-rn-va27 D Jan. 27, 2024, 6:43 p.m. OK PyPy 3-64 TESTS 18 233 9318400
243674273 gardengnome D Jan. 27, 2024, 7:48 p.m. OK PyPy 3-64 TESTS 18 248 11161600
243665045 SoleProprietor D Jan. 27, 2024, 6:44 p.m. OK PyPy 3-64 TESTS 18 248 12390400
243654678 cybsbbb D Jan. 27, 2024, 4:42 p.m. OK PyPy 3-64 TESTS 18 249 10854400
243672965 gardengnome D Jan. 27, 2024, 7:37 p.m. OK PyPy 3-64 TESTS 18 249 17100800
243664969 Non-origination D Jan. 27, 2024, 6:44 p.m. OK PyPy 3-64 TESTS 18 280 10444800
243687676 ScorpioDagger D Jan. 27, 2024, 10:42 p.m. OK PyPy 3-64 TESTS 18 280 11161600
243690681 Remineva D Jan. 27, 2024, 11:54 p.m. OK PyPy 3-64 TESTS 18 327 9625600
243696587 Sortt D Jan. 28, 2024, 2:14 a.m. OK PyPy 3-64 TESTS 18 342 13926400
243667400 OLOGY D Jan. 27, 2024, 6:57 p.m. OK Python 2 TESTS 18 514 16896000
243700903 21wh1a05i7 D Jan. 28, 2024, 3:21 a.m. OK Python 3 TESTS 18 468 0
243673705 smaheshwari2304 D Jan. 27, 2024, 7:43 p.m. OK Python 3 TESTS 18 483 0
243665651 cctt D Jan. 27, 2024, 6:48 p.m. OK Python 3 TESTS 18 483 0
243684495 Dunkler D Jan. 27, 2024, 9:42 p.m. OK Python 3 TESTS 18 545 13107200
243687552 Asbjorn D Jan. 27, 2024, 10:39 p.m. OK Python 3 TESTS 18 701 0
243709105 SeeleVollerei_ D Jan. 28, 2024, 5:10 a.m. OK Rust 2021 TESTS 18 31 1638400
243675813 snamy520 D Jan. 27, 2024, 8:01 p.m. OK Rust 2021 TESTS 18 405 4812800

remove filters

Back to search problems