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 |
|---|---|---|---|---|---|---|
| 2222 | Spectral::Cup 2026 Round 1 (Codeforces Round 1094, Div. 1 + Div. 2) | FINISHED | False | 9000 | 4202706 | April 25, 2026, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 195 ) | G | Statistics on Tree | PROGRAMMING | binary search brute force dfs and similar divide and conquer graphs trees |
You are given a tree of (n) vertices. We define the value of a pair ((u,v)) ((1\leq u\leq v\leq n)) as the size of the largest component after removing all edges on the path from (u) to (v) in the original tree. For every (1\leq i\leq n), you have to find the number of pairs ((u,v)) satisfying that its value is (i). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((1\leq n \leq 10^5)) — the number of vertices. Then (n-1) lines follow, the (i)-th line containing two integers (u) and (v) ((1\leq u,v\leq n)) — the two vertices that the (i)-th edge connects. It is guaranteed that the given edges form a tree. It is guaranteed that the sum of (n) over all test cases does not exceed (5\cdot 10^5). For each test case, output (n) integers, the (i)-th of which denotes the number of distinct pairs ((u,v)) satisfying its value is (i). In the first test case, the value of pair ((1, 1)) is (1). In the second test case, the values of pairs ((1, 1)) and ((2, 2)) are both (2), because no edges will be removed. The value of pair ((1, 2)) is (1), because edge ((1, 2)) is on the path from (1) to (2) in the tree, and after removing it, there will be (2) components left, which are (\{1\}) and (\{2\}), and the size of the largest component is (1). In the sixth test case, the value of pair ((4, 6)) is (3), because edges ((3, 4)), ((2, 3)), and ((2, 6)) are on the path from (4) to (6) in the tree, and after removing them, there will be (4) components left, which are (\{1, 2, 5\}), (\{3, 7\}), (\{4\}), and (\{6\}), and the size of the largest component is (3). |
| Spectral::Cup 2026 Round 1 (Codeforces Round 1094, Div. 1 + Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 372525353 | nullbrain_ | G | April 25, 2026, 4:59 p.m. | OK | C# 13 | TESTS | 26 | 953 | 87756800 | ||
| 372537635 | Sunyn | G | April 25, 2026, 7:08 p.m. | OK | C++17 (GCC 7-32) | TESTS | 26 | 859 | 3891200 | ||
| 372537492 | TadijaSebez | G | April 25, 2026, 7:06 p.m. | OK | C++17 (GCC 7-32) | TESTS | 26 | 906 | 10240000 | ||
| 372516978 | potato167 | G | April 25, 2026, 4:26 p.m. | OK | C++17 (GCC 7-32) | TESTS | 26 | 1031 | 11571200 | ||
| 372525491 | HBPlayer | G | April 25, 2026, 4:59 p.m. | OK | C++17 (GCC 7-32) | TESTS | 26 | 1296 | 81305600 | ||
| 372550110 | codeBreaker_krrishb | G | April 25, 2026, 10:26 p.m. | OK | C++17 (GCC 7-32) | TESTS | 26 | 1812 | 9216000 | ||
| 372554035 | maxplus | G | April 26, 2026, 12:41 a.m. | OK | C++20 (GCC 13-64) | TESTS | 26 | 218 | 12390400 | ||
| 372553035 | maxplus | G | April 26, 2026, 12:04 a.m. | OK | C++20 (GCC 13-64) | TESTS | 26 | 250 | 12595200 | ||
| 372561590 | gofrozen21 | G | April 26, 2026, 2:10 a.m. | OK | C++20 (GCC 13-64) | TESTS | 26 | 593 | 90521600 | ||
| 372549074 | AA-2007 | G | April 25, 2026, 10 p.m. | OK | C++20 (GCC 13-64) | TESTS | 26 | 609 | 12390400 | ||
| 372550285 | maxplus | G | April 25, 2026, 10:30 p.m. | OK | C++20 (GCC 13-64) | TESTS | 26 | 609 | 17100800 | ||
| 372549115 | AA-2007 | G | April 25, 2026, 10:01 p.m. | OK | C++20 (GCC 13-64) | TESTS | 26 | 671 | 12492800 | ||
| 372526360 | gloria_mundi | G | April 25, 2026, 5:02 p.m. | OK | C++20 (GCC 13-64) | TESTS | 26 | 687 | 13619200 | ||
| 372543975 | Geothermal | G | April 25, 2026, 8:29 p.m. | OK | C++20 (GCC 13-64) | TESTS | 26 | 718 | 60313600 | ||
| 372510901 | Ormlis | G | April 25, 2026, 4:05 p.m. | OK | C++20 (GCC 13-64) | TESTS | 26 | 734 | 12083200 | ||
| 372519176 | Farhod | G | April 25, 2026, 4:35 p.m. | OK | C++20 (GCC 13-64) | TESTS | 26 | 765 | 12800000 | ||
| 372512812 | Nachia | G | April 25, 2026, 4:12 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 26 | 359 | 12595200 | ||
| 372518412 | seanlsy | G | April 25, 2026, 4:32 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 26 | 656 | 16384000 | ||
| 372524214 | XVIII | G | April 25, 2026, 4:55 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 26 | 750 | 12697600 | ||
| 372522211 | bunH2O | G | April 25, 2026, 4:47 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 26 | 750 | 24166400 | ||
| 372517563 | ecnerwala | G | April 25, 2026, 4:28 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 26 | 781 | 6553600 | ||
| 372531538 | Galetx | G | April 25, 2026, 6:09 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 26 | 796 | 15872000 | ||
| 372510428 | jiangbowen | G | April 25, 2026, 4:03 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 26 | 843 | 18944000 | ||
| 372524475 | Adam_GS | G | April 25, 2026, 4:55 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 26 | 859 | 14131200 | ||
| 372566149 | gshbholanath19 | G | April 26, 2026, 4:01 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 26 | 921 | 25804800 | ||
| 372531597 | Andreasyan | G | April 25, 2026, 6:09 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 26 | 937 | 13004800 | ||
| 372518898 | Egor | G | April 25, 2026, 4:34 p.m. | OK | Rust 2024 | TESTS | 26 | 1453 | 176844800 |
Back to search problems