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 |
|---|---|---|---|---|---|---|
| 2161 | Pinely Round 5 (Div. 1 + Div. 2) | FINISHED | False | 10800 | 14563523 | Oct. 30, 2025, 4:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 338 ) | F | SubMST | PROGRAMMING | combinatorics graphs trees |
You are given an undirected unweighted tree (T) with (n) vertices. Define a complete undirected weighted graph (G) with (n) vertices, where the weight of the edge between vertices (u) and (v) in (G) is equal to the distance between the two vertices in the original tree. For every possible subset of vertices, consider the minimum spanning tree (MST) of the subgraph of (G) induced by that subset of vertices. Compute the sum of the weights of the MST for all possible subsets of vertices. As this number is big, you are only required to output the sum modulo (10^9 + 7). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10000)). The description of the test cases follows. The first line contains an integer (n) ((1 \leq n \leq 5000)), the number of vertices in the tree. The following (n-1) lines contains two integers (u) and (v) ((1 \leq u,v \leq n)), representing an edge between vertices (u) and (v) in the tree. It is guaranteed that the sum of (n^2) over all test cases does not exceed (5000^2). Output a single integer, the sum of the MST weights for all possible subsets of vertices, modulo (10^9+7). The first test case is illustrated below. The subsets with at most one vertex are ommited since they have a weight of (0) and therefore do not contribute to the sum. |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 346768434 | pro_player | F | Oct. 31, 2025, 5:04 a.m. | OK | C++17 (GCC 7-32) | TESTS | 35 | 952 | 102400 | ||
| 346729519 | Axoryn | F | Oct. 30, 2025, 7:16 p.m. | OK | C++17 (GCC 7-32) | TESTS | 35 | 1405 | 96870400 | ||
| 346737523 | dreamoon_love_AA | F | Oct. 30, 2025, 8:15 p.m. | OK | C++17 (GCC 7-32) | TESTS | 35 | 2514 | 153497600 | ||
| 346721383 | 244mhq | F | Oct. 30, 2025, 6:43 p.m. | OK | C++17 (GCC 7-32) | TESTS | 35 | 2718 | 100659200 | ||
| 346749435 | Tianyi_lemon | F | Oct. 30, 2025, 11:47 p.m. | OK | C++17 (GCC 7-32) | TESTS | 35 | 3937 | 102400 | ||
| 346731952 | dreamoon_love_AA | F | Oct. 30, 2025, 7:26 p.m. | OK | C++17 (GCC 7-32) | TESTS | 35 | 4249 | 153497600 | ||
| 346727929 | as_dfsdf | F | Oct. 30, 2025, 7:09 p.m. | OK | C++17 (GCC 7-32) | TESTS | 35 | 4671 | 204902400 | ||
| 346726922 | Sanae | F | Oct. 30, 2025, 7:05 p.m. | OK | C++20 (GCC 13-64) | TESTS | 35 | 390 | 201523200 | ||
| 346743475 | testerAbstract | F | Oct. 30, 2025, 9:33 p.m. | OK | C++20 (GCC 13-64) | TESTS | 35 | 405 | 102400 | ||
| 346714378 | Ashfyr | F | Oct. 30, 2025, 6:19 p.m. | OK | C++20 (GCC 13-64) | TESTS | 35 | 436 | 0 | ||
| 346735844 | andrei6184 | F | Oct. 30, 2025, 7:59 p.m. | OK | C++20 (GCC 13-64) | TESTS | 35 | 718 | 0 | ||
| 346748078 | Monis_70 | F | Oct. 30, 2025, 11:11 p.m. | OK | C++20 (GCC 13-64) | TESTS | 35 | 718 | 102400 | ||
| 346722959 | flareed | F | Oct. 30, 2025, 6:49 p.m. | OK | C++20 (GCC 13-64) | TESTS | 35 | 1046 | 7987200 | ||
| 346723833 | DemberS06 | F | Oct. 30, 2025, 6:53 p.m. | OK | C++20 (GCC 13-64) | TESTS | 35 | 1202 | 102400 | ||
| 346748271 | MAXXia | F | Oct. 30, 2025, 11:15 p.m. | OK | C++20 (GCC 13-64) | TESTS | 35 | 1328 | 409600 | ||
| 346733404 | 1121Jiang | F | Oct. 30, 2025, 7:32 p.m. | OK | C++20 (GCC 13-64) | TESTS | 35 | 1328 | 409600 | ||
| 346714196 | turmax | F | Oct. 30, 2025, 6:19 p.m. | OK | C++20 (GCC 13-64) | TESTS | 35 | 1390 | 201113600 | ||
| 346743497 | hungchi17 | F | Oct. 30, 2025, 9:34 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 35 | 406 | 201523200 | ||
| 346735929 | Harsh_kunwar | F | Oct. 30, 2025, 8 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 35 | 421 | 102400 | ||
| 346772269 | CountingGroup | F | Oct. 31, 2025, 5:47 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 35 | 624 | 307200 | ||
| 346736738 | never_giveup | F | Oct. 30, 2025, 8:07 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 35 | 655 | 99225600 | ||
| 346713534 | 353cerega | F | Oct. 30, 2025, 6:17 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 35 | 655 | 100454400 | ||
| 346722465 | tute7627 | F | Oct. 30, 2025, 6:47 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 35 | 702 | 0 | ||
| 346732334 | eric574 | F | Oct. 30, 2025, 7:27 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 35 | 874 | 8089600 | ||
| 346773920 | CountingGroup | F | Oct. 31, 2025, 6:03 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 35 | 875 | 101273600 | ||
| 346733914 | risujiroh | F | Oct. 30, 2025, 7:33 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 35 | 906 | 0 | ||
| 346728079 | Mans-21 | F | Oct. 30, 2025, 7:10 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 35 | 906 | 16896000 | ||
| 346746444 | gua069 | F | Oct. 30, 2025, 10:31 p.m. | OK | Java 8 | TESTS | 35 | 749 | 0 | ||
| 346718227 | arvindf232 | F | Oct. 30, 2025, 6:32 p.m. | OK | Kotlin 1.7 | TESTS | 35 | 4515 | 52121600 | ||
| 346718431 | Tlatoani | F | Oct. 30, 2025, 6:32 p.m. | OK | Kotlin 2.2 | TESTS | 35 | 4015 | 136601600 | ||
| 346732759 | Sugar_fan | F | Oct. 30, 2025, 7:29 p.m. | OK | Rust 2024 | TESTS | 35 | 4858 | 15257600 |
Back to search problems