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.
Problems
B"This is an interactive problem. You are given a tree -- connected undirected graph without cycles. One vertex of the tree is special, and you have to find which one. You can ask questions in the following form: given an edge of the tree, which endpoint is closer to the special vertex, meaning which endpoint's shortest path to the special vertex contains fewer edges. You have to find the special vertex by asking the minimum number of questions in the worst case for a given tree. Please note that the special vertex might not be fixed by the interactor in advance: it might change the vertex to any other one, with the requirement of being consistent with the previously given answers. You are given an integer n ( 2 <= n <= 100 ) -- the number of vertices in a tree. The folloiwing n-1 lines contain two integers each, u and v ( 1 <= u, v <= n ), that denote an edge in the tree connecting u and v . It is guaranteed that the given edges form a tree. After reading the input data, one can start making queries. There are two possible queries: Do not forget to output the end of line and flush the output. Otherwise you will get Idleness limit exceeded verdict. To flush the output, you can use: In case you ask more queries than needed in the worst case for a given tree, you will get verdict Wrong answer. Hacks are forbidden in this task. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
97391457 |
zx2003 |
E |
Nov. 2, 2020, 1:31 a.m. |
OK |
GNU C++17 (64) |
TESTS |
142 |
46 |
0 |
|
|
97359218 |
Benq |
E |
Nov. 1, 2020, 1:53 p.m. |
OK |
GNU C++17 (64) |
TESTS |
142 |
46 |
102400 |
|
|
97355848 |
yosupo |
E |
Nov. 1, 2020, 1:27 p.m. |
OK |
GNU C++17 (64) |
TESTS |
142 |
46 |
102400 |
|
|
97369983 |
sh1194 |
E |
Nov. 1, 2020, 3:57 p.m. |
OK |
GNU C++17 (64) |
TESTS |
142 |
312 |
2048000 |
|
|
97369717 |
sh1194 |
E |
Nov. 1, 2020, 3:54 p.m. |
OK |
GNU C++17 (64) |
TESTS |
142 |
312 |
2048000 |
|
|
97356067 |
skip2004 |
E |
Nov. 1, 2020, 1:28 p.m. |
OK |
GNU C++17 (64) |
TESTS |
142 |
327 |
2048000 |
|
|
97369805 |
sh1194 |
E |
Nov. 1, 2020, 3:55 p.m. |
OK |
GNU C++17 (64) |
TESTS |
142 |
342 |
2048000 |
|
|
remove filters
Back to search problems