Codeforces Round 872 (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
1824 Codeforces Round 872 (Div. 1) FINISHED False 7200 53718863 May 8, 2023, 12:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 2807 ) B2 LuoTianyi and the Floating Islands (Hard Version) PROGRAMMING combinatorics dfs and similar math probabilities trees 2300

B"This is the hard version of the problem. The only difference is that in this version k <= n . You can make hacks only if both versions of the problem are solved. LuoTianyi now lives in a world with n floating islands. The floating islands are connected by n-1 undirected air routes, and any two of them can reach each other by passing the routes. That means, the n floating islands form a tree. One day, LuoTianyi wants to meet her friends: Chtholly, Nephren, William, .... Totally, she wants to meet k people. She doesn't know the exact positions of them, but she knows that they are in pairwise distinct islands. She define an island is good if and only if the sum of the distances ^{ dagger} from it to the islands with k people is the minimal among all the n islands. Now, LuoTianyi wants to know that, if the k people are randomly set in k distinct of the n islands, then what is the expect number of the good islands? You just need to tell her the expect number modulo 10^9+7 . ^{ dagger} The distance between two islands is the minimum number of air routes you need to take to get from one island to the other. The first line contains two integers n and k ( 1 <= k <= n <= 2 cdot 10^5 ) -- the number of the islands and people respectively. Next n xe2 x88 x921 lines describe the air routes. The i -th of them contains two integers u_i and v_i ( 1 <= u_i,v_i <= n, u_i neq v_i ) -- the islands connected by the i -th air route. Print a single integer -- the expect number of the good islands modulo 10^9 + 7 . Formally, let M = 10^9 + 7 . 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 ( operatorname{mod} M ). Output the integer equal to p cdot q^{-1} operatorname{mod} M . In other words, output such an integer x$$"...

Tutorials

CodeForces Round 872(Div. 1&2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
205363251 mban259 B2 May 10, 2023, 6:54 p.m. OK C# 10 TESTS 27 264 30105600 2300
205086802 hos.lyric B2 May 8, 2023, 12:18 p.m. OK D TESTS 27 312 29184000 2300
206104090 CaveNightingale B2 May 16, 2023, 3:10 p.m. OK GNU C11 TESTS 27 171 15974400 2300
205227131 jiangbowen B2 May 9, 2023, 12:59 p.m. OK GNU C++14 TESTS 27 78 71577600 2300
205175940 XZC__Bobby B2 May 9, 2023, 1:53 a.m. OK GNU C++14 TESTS 27 93 9113600 2300
205395434 Leasier B2 May 11, 2023, 6:36 a.m. OK GNU C++14 TESTS 27 93 10649600 2300
205219545 c1120231020 B2 May 9, 2023, 11:56 a.m. OK GNU C++14 TESTS 27 93 18534400 2300
205209180 vjudge5 B2 May 9, 2023, 10:12 a.m. OK GNU C++14 TESTS 27 109 11673600 2300
205376342 Shui_Dream B2 May 10, 2023, 11:24 p.m. OK GNU C++14 TESTS 27 109 13926400 2300
205332703 afresh B2 May 10, 2023, 1:29 p.m. OK GNU C++14 TESTS 27 109 130969600 2300
206094718 Pilgrims B2 May 16, 2023, 1:42 p.m. OK GNU C++14 TESTS 27 124 7987200 2300
205202111 king20090712 B2 May 9, 2023, 9:02 a.m. OK GNU C++14 TESTS 27 124 10035200 2300
205107679 E-ray B2 May 8, 2023, 1:14 p.m. OK GNU C++14 TESTS 27 124 10649600 2300
205383847 wanghaoze B2 May 11, 2023, 3:09 a.m. OK GNU C++17 TESTS 27 77 12185600 2300
205132475 MarbIue B2 May 8, 2023, 2:59 p.m. OK GNU C++17 TESTS 27 109 20787200 2300
205097315 Natsuzora B2 May 8, 2023, 12:42 p.m. OK GNU C++17 TESTS 27 124 10854400 2300
206209196 to_the_north B2 May 17, 2023, 12:24 p.m. OK GNU C++17 TESTS 27 139 10752000 2300
205152772 radoslav11 B2 May 8, 2023, 6:01 p.m. OK GNU C++17 TESTS 27 139 13312000 2300
205200230 srikaran_p B2 May 9, 2023, 8:42 a.m. OK GNU C++17 TESTS 27 139 13926400 2300
205166779 Luca B2 May 8, 2023, 9:25 p.m. OK GNU C++17 TESTS 27 155 11468800 2300
205349552 TamimEhsan B2 May 10, 2023, 4:10 p.m. OK GNU C++17 TESTS 27 155 13107200 2300
205132946 patou B2 May 8, 2023, 3:02 p.m. OK GNU C++17 TESTS 27 155 13619200 2300
205670734 kimmoqt B2 May 13, 2023, 5:08 a.m. OK GNU C++17 TESTS 27 155 14028800 2300
205827206 BootsHua B2 May 14, 2023, 11:43 a.m. OK GNU C++17 (64) TESTS 27 61 25497600 2300
205097200 Z-302 B2 May 8, 2023, 12:42 p.m. OK GNU C++17 (64) TESTS 27 93 24371200 2300
205091839 crashed B2 May 8, 2023, 12:28 p.m. OK GNU C++17 (64) TESTS 27 109 13619200 2300
205088168 zqyyy B2 May 8, 2023, 12:20 p.m. OK GNU C++17 (64) TESTS 27 109 19148800 2300
205094269 stOzenghaoweiOrz B2 May 8, 2023, 12:34 p.m. OK GNU C++17 (64) TESTS 27 124 16896000 2300
205301753 frankly6 B2 May 10, 2023, 7:55 a.m. OK GNU C++17 (64) TESTS 27 124 18227200 2300
205394426 Yuudachihouteishiki B2 May 11, 2023, 6:23 a.m. OK GNU C++17 (64) TESTS 27 124 19660800 2300
205172836 yangjl B2 May 9, 2023, 12:26 a.m. OK GNU C++17 (64) TESTS 27 139 18739200 2300
205184638 ChroneZU B2 May 9, 2023, 5:05 a.m. OK GNU C++17 (64) TESTS 27 140 18534400 2300
205252696 trainwithoutpain B2 May 9, 2023, 4:47 p.m. OK GNU C++17 (64) TESTS 27 140 19660800 2300
205175172 Zhouershan B2 May 9, 2023, 1:32 a.m. OK GNU C++20 (64) TESTS 27 31 251596800 2300
205105656 Zhouershan B2 May 8, 2023, 1:08 p.m. OK GNU C++20 (64) TESTS 27 31 251596800 2300
205177571 gjy5885 B2 May 9, 2023, 2:32 a.m. OK GNU C++20 (64) TESTS 27 78 19046400 2300
205111045 wanghai673 B2 May 8, 2023, 1:25 p.m. OK GNU C++20 (64) TESTS 27 78 19968000 2300
205137609 mehrunesartem B2 May 8, 2023, 3:38 p.m. OK GNU C++20 (64) TESTS 27 78 22016000 2300
205531024 xukai B2 May 12, 2023, 11:50 a.m. OK GNU C++20 (64) TESTS 27 93 11878400 2300
205216079 luogu_bot3 B2 May 9, 2023, 11:25 a.m. OK GNU C++20 (64) TESTS 27 93 13619200 2300
205094160 Nephry B2 May 8, 2023, 12:34 p.m. OK GNU C++20 (64) TESTS 27 93 15257600 2300
205234509 CC2021zyz B2 May 9, 2023, 2:03 p.m. OK GNU C++20 (64) TESTS 27 93 23552000 2300
205265550 maxplus B2 May 9, 2023, 7:19 p.m. OK GNU C++20 (64) TESTS 27 109 17100800 2300
205173895 0x3F B2 May 9, 2023, 12:58 a.m. OK Go TESTS 27 233 30310400 2300
205139472 knightL B2 May 8, 2023, 3:54 p.m. OK Java 11 TESTS 27 857 45465600 2300
205105773 insert_cool_handle B2 May 8, 2023, 1:08 p.m. OK Java 11 TESTS 27 951 108134400 2300
205272511 kamranm B2 May 9, 2023, 9:34 p.m. OK Java 17 TESTS 27 670 222617600 2300
205163932 Aemon B2 May 8, 2023, 8:32 p.m. OK Java 17 TESTS 27 857 36454400 2300
205158451 fetetriste B2 May 8, 2023, 7:09 p.m. OK Java 8 TESTS 27 296 15052800 2300
205132456 Virendra115 B2 May 8, 2023, 2:59 p.m. OK Java 8 TESTS 27 483 37785600 2300
205670659 Turkhuuu B2 May 13, 2023, 5:07 a.m. OK Java 8 TESTS 27 483 41472000 2300
205393518 yvbf B2 May 11, 2023, 6:10 a.m. OK Java 8 TESTS 27 763 49766400 2300
205338123 cc4414 B2 May 10, 2023, 2:16 p.m. OK Java 8 TESTS 27 1044 86425600 2300
205106644 top73only B2 May 8, 2023, 1:11 p.m. OK Kotlin 1.6 TESTS 27 405 15257600 2300
205098197 Tlatoani B2 May 8, 2023, 12:45 p.m. OK Kotlin 1.7 TESTS 27 1169 170803200 2300
205129667 hxu10 B2 May 8, 2023, 2:41 p.m. OK PyPy 3 TESTS 27 888 59289600 2300
205129549 hxu10 B2 May 8, 2023, 2:40 p.m. OK PyPy 3 TESTS 27 1341 68915200 2300
205169935 bronze_coder B2 May 8, 2023, 10:46 p.m. OK PyPy 3-64 TESTS 27 405 56115200 2300
205490332 blue_ice_yj B2 May 12, 2023, 2:22 a.m. OK PyPy 3-64 TESTS 27 514 81920000 2300
205114235 plevande B2 May 8, 2023, 1:36 p.m. OK PyPy 3-64 TESTS 27 561 68403200 2300
205115148 dyppp B2 May 8, 2023, 1:39 p.m. OK PyPy 3-64 TESTS 27 904 58470400 2300
205129721 hxu10 B2 May 8, 2023, 2:41 p.m. OK PyPy 3-64 TESTS 27 935 81203200 2300
205112945 toam B2 May 8, 2023, 1:32 p.m. OK PyPy 3-64 TESTS 27 1730 109158400 2300
205203775 Spheniscine B2 May 9, 2023, 9:19 a.m. OK Rust 2021 TESTS 27 109 26521600 2300
205128373 sansen B2 May 8, 2023, 2:34 p.m. OK Rust 2021 TESTS 27 109 29081600 2300
205334372 cottoncotton B2 May 10, 2023, 1:44 p.m. OK Rust 2021 TESTS 27 109 94924800 2300
205128466 cpchenpi B2 May 8, 2023, 2:35 p.m. OK Rust 2021 TESTS 27 124 26009600 2300
205147417 cpchenpi B2 May 8, 2023, 5:06 p.m. OK Rust 2021 TESTS 27 140 25907200 2300
205104770 red_tree B2 May 8, 2023, 1:05 p.m. OK Rust 2021 TESTS 27 155 30720000 2300
205375644 kost B2 May 10, 2023, 11:04 p.m. OK Rust 2021 TESTS 27 171 24576000 2300
205220899 ilyshana B2 May 9, 2023, 12:08 p.m. OK Rust 2021 TESTS 27 171 26316800 2300
205129289 hiratai B2 May 8, 2023, 2:39 p.m. OK Rust 2021 TESTS 27 233 68096000 2300

remove filters

Back to search problems