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 |
---|---|---|---|---|---|---|
1695 | Codeforces Round 801 (Div. 2) and EPIC Institute of Technology Round | FINISHED | False | 7200 | 81617063 | June 18, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 2057 ) | D2 | Tree Queries (Hard Version) | PROGRAMMING | constructive algorithms dfs and similar dp greedy trees |
B"The only difference between this problem and D1 is the bound on the size of the tree. You are given an unrooted tree with n vertices. There is some hidden vertex x in that tree that you are trying to find. To do this, you may ask k queries v_1, v_2, ldots, v_k where the v_i are vertices in the tree. After you are finished asking all of the queries, you are given k numbers d_1, d_2, ldots, d_k , where d_i is the number of edges on the shortest path between v_i and x . Note that you know which distance corresponds to which query. What is the minimum k such that there exists some queries v_1, v_2, ldots, v_k that let you always uniquely identify x (no matter what x is). Note that you don't actually need to output these queries. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^4 ). Description of the test cases follows. The first line of each test case contains a single integer n ( 1 <= n <= 2 cdot10^5 ) -- the number of vertices in the tree. Each of the next n-1 lines contains two integers x and y ( 1 <= x, y <= n ), meaning there is an edges between vertices x and y in the tree. 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 2 cdot10^5 . For each test case print a single nonnegative integer, the minimum number of queries you need, on its own line. In the first test case, there is only one vertex, so you don't need any queries. In the second test case, you can ask a single query about the node 1 . Then, if x = 1 , you will get 0 , otherwise you will get 1 . "... |
Editorial for Codeforces Round #801 (Div. 2) and EPIC Institute of Technology Round |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
161135512 | LeonidR | D2 | June 18, 2022, 9:07 p.m. | OK | C# 10 | TESTS | 94 | 265 | 32972800 | ||
161122798 | mindino | D2 | June 18, 2022, 5:53 p.m. | OK | GNU C++14 | TESTS | 94 | 109 | 19148800 | ||
161144444 | duoluoluo | D2 | June 19, 2022, 2:43 a.m. | OK | GNU C++14 | TESTS | 94 | 124 | 14336000 | ||
161153003 | walk_alone | D2 | June 19, 2022, 5:46 a.m. | OK | GNU C++14 | TESTS | 94 | 124 | 15974400 | ||
161112603 | win10 | D2 | June 18, 2022, 4:26 p.m. | OK | GNU C++14 | TESTS | 94 | 140 | 24166400 | ||
161151667 | dengziyue | D2 | June 19, 2022, 5:26 a.m. | OK | GNU C++14 | TESTS | 94 | 155 | 13721600 | ||
161119908 | antguz | D2 | June 18, 2022, 5:32 p.m. | OK | GNU C++14 | TESTS | 94 | 156 | 8601600 | ||
161122717 | surwdkgo | D2 | June 18, 2022, 5:53 p.m. | OK | GNU C++14 | TESTS | 94 | 156 | 16588800 | ||
161132136 | dhruvrathi04 | D2 | June 18, 2022, 7:53 p.m. | OK | GNU C++14 | TESTS | 94 | 156 | 17510400 | ||
161120840 | oursaco | D2 | June 18, 2022, 5:38 p.m. | OK | GNU C++14 | TESTS | 94 | 171 | 10240000 | ||
161146701 | shadowYYH | D2 | June 19, 2022, 3:43 a.m. | OK | GNU C++14 | TESTS | 94 | 171 | 11264000 | ||
161144408 | lizh1 | D2 | June 19, 2022, 2:42 a.m. | OK | GNU C++17 | TESTS | 94 | 124 | 14336000 | ||
161121313 | saber777 | D2 | June 18, 2022, 5:41 p.m. | OK | GNU C++17 | TESTS | 94 | 155 | 8601600 | ||
161131205 | Maxymilian | D2 | June 18, 2022, 7:36 p.m. | OK | GNU C++17 | TESTS | 94 | 155 | 17817600 | ||
161122203 | Bobocan | D2 | June 18, 2022, 5:48 p.m. | OK | GNU C++17 | TESTS | 94 | 156 | 9625600 | ||
161138757 | VisenG | D2 | June 18, 2022, 10:59 p.m. | OK | GNU C++17 | TESTS | 94 | 156 | 14848000 | ||
161147075 | trek_walker | D2 | June 19, 2022, 3:52 a.m. | OK | GNU C++17 | TESTS | 94 | 156 | 17408000 | ||
161123598 | user3348 | D2 | June 18, 2022, 6:01 p.m. | OK | GNU C++17 | TESTS | 94 | 171 | 7782400 | ||
161113603 | shivangtiwari | D2 | June 18, 2022, 4:28 p.m. | OK | GNU C++17 | TESTS | 94 | 171 | 7782400 | ||
161127538 | gtushar2000 | D2 | June 18, 2022, 6:44 p.m. | OK | GNU C++17 | TESTS | 94 | 171 | 14848000 | ||
161124063 | Yzm007 | D2 | June 18, 2022, 6:05 p.m. | OK | GNU C++17 | TESTS | 94 | 171 | 15360000 | ||
161147645 | qwynick | D2 | June 19, 2022, 4:05 a.m. | OK | GNU C++17 (64) | TESTS | 94 | 109 | 22323200 | ||
161147402 | propane | D2 | June 19, 2022, 4 a.m. | OK | GNU C++17 (64) | TESTS | 94 | 109 | 22732800 | ||
161138823 | CartesianTree | D2 | June 18, 2022, 11:01 p.m. | OK | GNU C++17 (64) | TESTS | 94 | 124 | 46899200 | ||
161150354 | wuhypzz | D2 | June 19, 2022, 5:04 a.m. | OK | GNU C++17 (64) | TESTS | 94 | 140 | 10035200 | ||
161135728 | prokopton | D2 | June 18, 2022, 9:13 p.m. | OK | GNU C++17 (64) | TESTS | 94 | 155 | 25600000 | ||
161119939 | leeh18 | D2 | June 18, 2022, 5:32 p.m. | OK | GNU C++17 (64) | TESTS | 94 | 170 | 26419200 | ||
161149366 | xcyle | D2 | June 19, 2022, 4:44 a.m. | OK | GNU C++17 (64) | TESTS | 94 | 171 | 10752000 | ||
161125691 | Hyperbolic | D2 | June 18, 2022, 6:23 p.m. | OK | GNU C++17 (64) | TESTS | 94 | 171 | 24166400 | ||
161140725 | moo. | D2 | June 19, 2022, 12:28 a.m. | OK | GNU C++17 (64) | TESTS | 94 | 171 | 26419200 | ||
161137650 | Beevo | D2 | June 18, 2022, 10:13 p.m. | OK | GNU C++17 (64) | TESTS | 94 | 171 | 26419200 | ||
161119326 | sky123 | D2 | June 18, 2022, 5:29 p.m. | OK | GNU C++20 (64) | TESTS | 94 | 124 | 28876800 | ||
161139667 | gyh20 | D2 | June 18, 2022, 11:37 p.m. | OK | GNU C++20 (64) | TESTS | 94 | 124 | 32460800 | ||
161139830 | erdosnumber | D2 | June 18, 2022, 11:44 p.m. | OK | GNU C++20 (64) | TESTS | 94 | 140 | 14643200 | ||
161149445 | xdO_o | D2 | June 19, 2022, 4:45 a.m. | OK | GNU C++20 (64) | TESTS | 94 | 140 | 15052800 | ||
161136665 | spipipike | D2 | June 18, 2022, 9:38 p.m. | OK | GNU C++20 (64) | TESTS | 94 | 140 | 16486400 | ||
161133439 | pre_prime | D2 | June 18, 2022, 8:19 p.m. | OK | GNU C++20 (64) | TESTS | 94 | 140 | 16486400 | ||
161134336 | pravin_as | D2 | June 18, 2022, 8:40 p.m. | OK | GNU C++20 (64) | TESTS | 94 | 140 | 18944000 | ||
161125835 | fvogel | D2 | June 18, 2022, 6:24 p.m. | OK | GNU C++20 (64) | TESTS | 94 | 140 | 25497600 | ||
161120120 | Abdo... | D2 | June 18, 2022, 5:34 p.m. | OK | GNU C++20 (64) | TESTS | 94 | 140 | 28672000 | ||
161136795 | apoorv_me | D2 | June 18, 2022, 9:43 p.m. | OK | GNU C++20 (64) | TESTS | 94 | 140 | 31334400 | ||
161130128 | henrychenOutlook | D2 | June 18, 2022, 7:19 p.m. | OK | Java 11 | TESTS | 94 | 561 | 47923200 | ||
161124770 | freehandle | D2 | June 18, 2022, 6:13 p.m. | OK | Java 11 | TESTS | 94 | 576 | 103936000 | ||
161143126 | TimmyThinMints | D2 | June 19, 2022, 2:04 a.m. | OK | Java 11 | TESTS | 94 | 655 | 61235200 | ||
161119520 | dzhi | D2 | June 18, 2022, 5:30 p.m. | OK | Java 11 | TESTS | 94 | 888 | 78540800 | ||
161122525 | MagentaCobra | D2 | June 18, 2022, 5:51 p.m. | OK | Java 8 | TESTS | 94 | 171 | 18841600 | ||
161141535 | DylanSmith | D2 | June 19, 2022, 1:05 a.m. | OK | Java 8 | TESTS | 94 | 686 | 41164800 | ||
161129084 | SlavaG | D2 | June 18, 2022, 7:05 p.m. | OK | Kotlin 1.6 | TESTS | 94 | 1044 | 208691200 | ||
161129630 | SlavaG | D2 | June 18, 2022, 7:12 p.m. | OK | Kotlin 1.6 | TESTS | 94 | 1481 | 261222400 | ||
161121784 | Adroit_001 | D2 | June 18, 2022, 5:45 p.m. | OK | PyPy 3 | TESTS | 94 | 717 | 74137600 | ||
161111205 | myotra | D2 | June 18, 2022, 4:23 p.m. | OK | PyPy 3 | TESTS | 94 | 873 | 56627200 | ||
161124752 | Adroit_001 | D2 | June 18, 2022, 6:12 p.m. | OK | PyPy 3-64 | TESTS | 94 | 764 | 57753600 | ||
161120337 | huikang | D2 | June 18, 2022, 5:35 p.m. | OK | PyPy 3-64 | TESTS | 94 | 1154 | 122880000 | ||
161112313 | tassei903 | D2 | June 18, 2022, 4:25 p.m. | OK | PyPy 3-64 | TESTS | 94 | 1185 | 65433600 | ||
161130632 | Thallium54 | D2 | June 18, 2022, 7:28 p.m. | OK | Rust 2021 | TESTS | 94 | 108 | 40038400 | ||
161131674 | Thallium54 | D2 | June 18, 2022, 7:44 p.m. | OK | Rust 2021 | TESTS | 94 | 109 | 40448000 | ||
161131606 | Thallium54 | D2 | June 18, 2022, 7:43 p.m. | OK | Rust 2021 | TESTS | 94 | 139 | 39936000 | ||
161115699 | LittleFall | D2 | June 18, 2022, 4:32 p.m. | OK | Rust 2021 | TESTS | 94 | 186 | 39219200 |
Back to search problems