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'Consider a tree T (that is, a connected graph without cycles) with n vertices labelled 1 through n . We start the following process with T : while T has more than one vertex, do the following: At the end of the process, T consists of a single vertex labelled with one of the numbers 1, ldots, n . For each of the numbers, what is the probability of this number becoming the label of the final vertex? The first line contains a single integer n ( 1 <= q n <= q 50 ). The following n - 1 lines describe the tree edges. Each of these lines contains two integers u_i, v_i -- labels of vertices connected by the respective edge ( 1 <= q u_i, v_i <= q n , u_i neq v_i ). It is guaranteed that the given graph is a tree. Print n floating numbers -- the desired probabilities for labels 1, ldots, n respectively. All numbers should be correct up to 10^{-6} relative or absolute precision. In the first sample, the resulting vertex has label 1 if and only if for all three edges the label 1 survives, hence the probability is 1/2^3 = 1/8 . All other labels have equal probability due to symmetry, hence each of them has probability (1 - 1/8) / 3 = 7/24 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
54751714 |
Miracle_2001 |
F |
May 28, 2019, 1:09 p.m. |
OK |
GNU C++11 |
TESTS |
39 |
30 |
102400 |
|
2800 |
43989617 |
goldgenius |
F |
Oct. 8, 2018, 9:24 a.m. |
OK |
GNU C++11 |
TESTS |
39 |
30 |
409600 |
|
2800 |
67587387 |
mlby |
F |
Dec. 25, 2019, 8:49 a.m. |
OK |
GNU C++11 |
TESTS |
39 |
31 |
0 |
|
2800 |
60071863 |
hk_cnyali |
F |
Sept. 5, 2019, 11:23 a.m. |
OK |
GNU C++11 |
TESTS |
39 |
31 |
0 |
|
2800 |
60014279 |
LuoshuiTianyi |
F |
Sept. 4, 2019, 11:26 a.m. |
OK |
GNU C++11 |
TESTS |
39 |
31 |
0 |
|
2800 |
59378725 |
z_q_c |
F |
Aug. 24, 2019, 1:02 a.m. |
OK |
GNU C++11 |
TESTS |
39 |
31 |
0 |
|
2800 |
59342499 |
xcyxcy |
F |
Aug. 23, 2019, 8:11 a.m. |
OK |
GNU C++11 |
TESTS |
39 |
31 |
0 |
|
2800 |
57868273 |
lopare |
F |
July 27, 2019, 11:05 p.m. |
OK |
GNU C++11 |
TESTS |
39 |
31 |
0 |
|
2800 |
57736213 |
py_ultron |
F |
July 25, 2019, 10:01 a.m. |
OK |
GNU C++11 |
TESTS |
39 |
31 |
0 |
|
2800 |
57256595 |
clya2004 |
F |
July 18, 2019, 2:44 a.m. |
OK |
GNU C++11 |
TESTS |
39 |
31 |
0 |
|
2800 |
46674583 |
xielinhan |
F |
Dec. 6, 2018, 9:01 a.m. |
OK |
GNU C++14 |
TESTS |
39 |
30 |
0 |
|
2800 |
43782430 |
black_horse2014 |
F |
Oct. 4, 2018, 11:03 a.m. |
OK |
GNU C++14 |
TESTS |
39 |
30 |
204800 |
|
2800 |
43989396 |
The_Unbeatable |
F |
Oct. 8, 2018, 9:17 a.m. |
OK |
GNU C++14 |
TESTS |
39 |
30 |
512000 |
|
2800 |
43790725 |
std_algorithm |
F |
Oct. 4, 2018, 1:44 p.m. |
OK |
GNU C++14 |
TESTS |
39 |
30 |
512000 |
|
2800 |
47858569 |
luogu_bot3 |
F |
Jan. 3, 2019, 3:06 a.m. |
OK |
GNU C++14 |
TESTS |
39 |
30 |
2355200 |
|
2800 |
64677936 |
hjc20032003 |
F |
Nov. 11, 2019, 8:49 a.m. |
OK |
GNU C++14 |
TESTS |
39 |
31 |
0 |
|
2800 |
64666516 |
1351593868 |
F |
Nov. 11, 2019, 2:49 a.m. |
OK |
GNU C++14 |
TESTS |
39 |
31 |
0 |
|
2800 |
44755452 |
foreverpiano |
F |
Oct. 24, 2018, 12:20 a.m. |
OK |
GNU C++14 |
TESTS |
39 |
31 |
0 |
|
2800 |
44317045 |
_Sakits |
F |
Oct. 14, 2018, 12:49 p.m. |
OK |
GNU C++14 |
TESTS |
39 |
31 |
0 |
|
2800 |
44317010 |
_Sakits |
F |
Oct. 14, 2018, 12:47 p.m. |
OK |
GNU C++14 |
TESTS |
39 |
31 |
0 |
|
2800 |
66011863 |
flashmt |
F |
Nov. 30, 2019, 3:03 a.m. |
OK |
GNU C++17 |
TESTS |
39 |
15 |
204800 |
|
2800 |
54799111 |
luogu_bot5 |
F |
May 29, 2019, 11:09 a.m. |
OK |
GNU C++17 |
TESTS |
39 |
31 |
0 |
|
2800 |
54799039 |
Fulisike |
F |
May 29, 2019, 11:06 a.m. |
OK |
GNU C++17 |
TESTS |
39 |
31 |
0 |
|
2800 |
53013252 |
CMXRYNP |
F |
April 19, 2019, 1:02 p.m. |
OK |
GNU C++17 |
TESTS |
39 |
31 |
0 |
|
2800 |
52261137 |
Rose_max |
F |
April 3, 2019, 8:51 a.m. |
OK |
GNU C++17 |
TESTS |
39 |
31 |
0 |
|
2800 |
43983508 |
New-ErA |
F |
Oct. 8, 2018, 5:18 a.m. |
OK |
GNU C++17 |
TESTS |
39 |
31 |
0 |
|
2800 |
66434053 |
justfocusplease |
F |
Dec. 7, 2019, 5:11 a.m. |
OK |
GNU C++17 |
TESTS |
39 |
31 |
204800 |
|
2800 |
66002472 |
flashmt |
F |
Nov. 29, 2019, 7:43 p.m. |
OK |
GNU C++17 |
TESTS |
39 |
31 |
204800 |
|
2800 |
57293438 |
cjc |
F |
July 18, 2019, 5:52 p.m. |
OK |
GNU C++17 |
TESTS |
39 |
31 |
204800 |
|
2800 |
54999879 |
HirasawaaYui |
F |
June 3, 2019, 3:38 a.m. |
OK |
GNU C++17 |
TESTS |
39 |
31 |
204800 |
|
2800 |
43922971 |
tri |
F |
Oct. 7, 2018, 2:21 a.m. |
OK |
Java 8 |
TESTS |
39 |
140 |
0 |
|
2800 |
43989458 |
vjudge3 |
F |
Oct. 8, 2018, 9:19 a.m. |
OK |
MS C++ |
TESTS |
39 |
31 |
409600 |
|
2800 |
44177383 |
quarteer |
F |
Oct. 12, 2018, 9:31 a.m. |
OK |
Python 3 |
TESTS |
39 |
405 |
0 |
|
2800 |
remove filters
Back to search problems