CodeCraft-22 and Codeforces Round 795 (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
1691 CodeCraft-22 and Codeforces Round 795 (Div. 2) FINISHED False 7200 83172263 May 31, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1008 ) F K-Set Tree PROGRAMMING combinatorics dfs and similar dp math trees

B'You are given a tree G with n vertices and an integer k . The vertices of the tree are numbered from 1 to n . For a vertex r and a subset S of vertices of G , such that |S| = k , we define f(r, S) as the size of the smallest rooted subtree containing all vertices in S when the tree is rooted at r . A set of vertices T is called a rooted subtree, if all the vertices in T are connected, and for each vertex in T , all its descendants belong to T . You need to calculate the sum of f(r, S) over all possible distinct combinations of vertices r and subsets S , where |S| = k . Formally, compute the following: sum_{r in V} sum_{S subseteq V, |S| = k} f(r, S), where V is the set of vertices in G . Output the answer modulo 10^9 + 7 . The first line contains two integers n and k ( 3 <= n <= 2 cdot 10^5 , 1 <= k <= n ). Each of the following n - 1 lines contains two integers x and y ( 1 <= x, y <= n ), denoting an edge between vertex x and y . It is guaranteed that the given edges form a tree. Print the answer modulo 10^9 + 7 . The tree in the second example is given below: We have 21 subsets of size 2 in the given tree. Hence, S in <= ft { {1, 2 }, {1, 3 }, {1, 4 }, {1, 5 }, {1, 6 }, {1, 7 }, {2, 3 }, {2, 4 }, {2, 5 }, {2, 6 }, {2, 7 }, {3, 4 }, {3, 5 }, {3, 6 }, {3, 7 }, {4, 5 }, {4, 6 }, {4, 7 }, {5, 6 }, {5, 7 }, {6, 7 } right }. And since we have 7 vertices, 1 <= r <= 7 . We need to find the sum of f(r, S) over all possible pairs of r and S . Below we have listed the value of f(r, S) for some combinations of r and S . '...

Tutorials

Editorial for CodeCraft-22 and Codeforces Round #795 (Div. 2)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
159162952 liuyaningqwq F June 1, 2022, 1 p.m. OK GNU C++14 TESTS 64 187 40140800
159179390 walk_alone F June 1, 2022, 4:08 p.m. OK GNU C++14 TESTS 64 217 30720000
159204032 basic_string F June 2, 2022, 12:04 a.m. OK GNU C++14 TESTS 64 218 22016000
159158417 bkifhr7 F June 1, 2022, 12:07 p.m. OK GNU C++14 TESTS 64 218 29900800
159158387 Cafard F June 1, 2022, 12:07 p.m. OK GNU C++14 TESTS 64 234 29900800
159161164 vjudge1 F June 1, 2022, 12:39 p.m. OK GNU C++14 TESTS 64 234 31539200
159163235 Max_s_xaM F June 1, 2022, 1:03 p.m. OK GNU C++14 TESTS 64 249 32972800
159163475 bkifhr9 F June 1, 2022, 1:06 p.m. OK GNU C++14 TESTS 64 280 25292800
159163459 displace F June 1, 2022, 1:06 p.m. OK GNU C++14 TESTS 64 280 25292800
159205523 lingfunny F June 2, 2022, 1:06 a.m. OK GNU C++14 TESTS 64 280 25907200
159166671 SiRiehn_nx F June 1, 2022, 1:41 p.m. OK GNU C++17 TESTS 64 171 20070400
159128589 huxch135 F June 1, 2022, 6:25 a.m. OK GNU C++17 TESTS 64 249 19456000
159175574 GStnt F June 1, 2022, 3:24 p.m. OK GNU C++17 TESTS 64 249 21401600
159204166 kk19212 F June 2, 2022, 12:11 a.m. OK GNU C++17 TESTS 64 249 38809600
159207295 kamer F June 2, 2022, 2:10 a.m. OK GNU C++17 TESTS 64 280 41369600
159144585 Karashi F June 1, 2022, 9:30 a.m. OK GNU C++17 TESTS 64 280 105574400
159155770 stark2002 F June 1, 2022, 11:36 a.m. OK GNU C++17 TESTS 64 295 39936000
159156912 sarthak123 F June 1, 2022, 11:49 a.m. OK GNU C++17 TESTS 64 295 40652800
159137352 xxafhixx F June 1, 2022, 8:10 a.m. OK GNU C++17 TESTS 64 296 21606400
159195601 DragonO_o F June 1, 2022, 7:46 p.m. OK GNU C++17 TESTS 64 296 73830400
159138872 Bobocan F June 1, 2022, 8:28 a.m. OK GNU C++17 (64) TESTS 64 140 24473600
159134580 Bobocan F June 1, 2022, 7:36 a.m. OK GNU C++17 (64) TESTS 64 155 22835200
159187269 Lucina F June 1, 2022, 5:42 p.m. OK GNU C++17 (64) TESTS 64 217 35225600
159127589 KKT_89 F June 1, 2022, 6:13 a.m. OK GNU C++17 (64) TESTS 64 218 59494400
159205655 tabr F June 2, 2022, 1:10 a.m. OK GNU C++17 (64) TESTS 64 249 34918400
159210102 Celtic F June 2, 2022, 3:35 a.m. OK GNU C++17 (64) TESTS 64 249 42291200
159187515 Lucina F June 1, 2022, 5:45 p.m. OK GNU C++17 (64) TESTS 64 264 35225600
159168514 Andreasyan F June 1, 2022, 2:01 p.m. OK GNU C++17 (64) TESTS 64 264 36966400
159174588 Artemis_Bow F June 1, 2022, 3:12 p.m. OK GNU C++17 (64) TESTS 64 280 33689600
159170759 SmolBrain F June 1, 2022, 2:26 p.m. OK GNU C++17 (64) TESTS 64 280 53452800
159134870 Alcabel F June 1, 2022, 7:40 a.m. OK GNU C++20 (64) TESTS 64 156 33587200
159210351 Forza_Ferrari F June 2, 2022, 3:42 a.m. OK GNU C++20 (64) TESTS 64 186 35225600
159154791 10circle F June 1, 2022, 11:24 a.m. OK GNU C++20 (64) TESTS 64 187 36966400
159166753 NotANoob F June 1, 2022, 1:42 p.m. OK GNU C++20 (64) TESTS 64 202 34201600
159216238 Killer250104 F June 2, 2022, 5:41 a.m. OK GNU C++20 (64) TESTS 64 202 37478400
159162063 Mangooste F June 1, 2022, 12:50 p.m. OK GNU C++20 (64) TESTS 64 217 35225600
159147615 wakaka F June 1, 2022, 10:03 a.m. OK GNU C++20 (64) TESTS 64 217 35532800
159127121 blackbird137 F June 1, 2022, 6:07 a.m. OK GNU C++20 (64) TESTS 64 217 45158400
159194198 Prateek F June 1, 2022, 7:20 p.m. OK GNU C++20 (64) TESTS 64 217 51609600
159128512 Alfeh F June 1, 2022, 6:24 a.m. OK GNU C++20 (64) TESTS 64 218 58982400
159194290 xsc F June 1, 2022, 7:22 p.m. OK MS C++ 2017 TESTS 64 577 19456000
159173621 Sharashandra_131 F June 1, 2022, 2:59 p.m. OK PyPy 3-64 TESTS 64 1294 74547200
159209813 AndrescuIII F June 2, 2022, 3:26 a.m. OK Python 3 TESTS 64 2995 49868800
159134755 sansen F June 1, 2022, 7:39 a.m. OK Rust 2021 TESTS 64 155 40140800

remove filters

Back to search problems