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'Vasya has got a tree consisting of n vertices. He wants to delete some (possibly zero) edges in this tree such that the maximum matching in the resulting graph is unique. He asks you to calculate the number of ways to choose a set of edges to remove. A matching in the graph is a subset of its edges such that there is no vertex incident to two (or more) edges from the subset. A maximum matching is a matching such that the number of edges in the subset is maximum possible among all matchings in this graph. Since the answer may be large, output it modulo 998244353 . The first line contains one integer n ( 1 <= n <= 3 cdot 10^5 ) -- the number of vertices in the tree. Each of the next n xe2 x88 x92 1 lines contains two integers u and v ( 1 <= u, v <= n, u neq v ) denoting an edge between vertex u and vertex v . It is guaranteed that these edges form a tree. Print one integer -- the number of ways to delete some (possibly empty) subset of edges so that the maximum matching in the resulting graph is unique. Print the answer modulo 998244353 . Possible ways to delete edges in the first example: Possible ways to delete edges in the second example: '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
46052951 |
luogu_bot1 |
F |
Nov. 22, 2018, 9:01 a.m. |
OK |
GNU C++11 |
TESTS |
60 |
93 |
36864000 |
|
2600 |
54365936 |
__23333 |
F |
May 19, 2019, 2:44 a.m. |
OK |
GNU C++11 |
TESTS |
60 |
93 |
44748800 |
|
2600 |
51117278 |
luogu_bot4 |
F |
March 10, 2019, 7:34 a.m. |
OK |
GNU C++11 |
TESTS |
60 |
109 |
33177600 |
|
2600 |
54365955 |
__23333 |
F |
May 19, 2019, 2:46 a.m. |
OK |
GNU C++11 |
TESTS |
60 |
109 |
44748800 |
|
2600 |
51116859 |
vjudge1 |
F |
March 10, 2019, 7:24 a.m. |
OK |
GNU C++11 |
TESTS |
60 |
156 |
20889600 |
|
2600 |
46053939 |
Thost |
F |
Nov. 22, 2018, 9:43 a.m. |
OK |
GNU C++11 |
TESTS |
60 |
156 |
46592000 |
|
2600 |
51117198 |
luogu_bot4 |
F |
March 10, 2019, 7:31 a.m. |
OK |
GNU C++11 |
TESTS |
60 |
171 |
28057600 |
|
2600 |
51116638 |
hyn0027 |
F |
March 10, 2019, 7:16 a.m. |
OK |
GNU C++11 |
TESTS |
60 |
186 |
20889600 |
|
2600 |
51117377 |
vjudge5 |
F |
March 10, 2019, 7:36 a.m. |
OK |
GNU C++11 |
TESTS |
60 |
186 |
28057600 |
|
2600 |
51117444 |
vjudge5 |
F |
March 10, 2019, 7:37 a.m. |
OK |
GNU C++11 |
TESTS |
60 |
187 |
28057600 |
|
2600 |
46667200 |
Samaritan123 |
F |
Dec. 6, 2018, 3:32 a.m. |
OK |
GNU C++14 |
TESTS |
60 |
280 |
49254400 |
|
2600 |
49165177 |
Jester |
F |
Jan. 29, 2019, 4:13 p.m. |
OK |
GNU C++14 |
TESTS |
60 |
295 |
40243200 |
|
2600 |
51829827 |
Amidethuong27 |
F |
March 25, 2019, 3:39 p.m. |
OK |
GNU C++14 |
TESTS |
60 |
295 |
58470400 |
|
2600 |
45980507 |
bgrm |
F |
Nov. 19, 2018, 10:38 p.m. |
OK |
GNU C++14 |
TESTS |
60 |
296 |
48640000 |
|
2600 |
51829926 |
Amidethuong27 |
F |
March 25, 2019, 3:41 p.m. |
OK |
GNU C++14 |
TESTS |
60 |
311 |
53657600 |
|
2600 |
53953025 |
DimmyT |
F |
May 10, 2019, 10:33 a.m. |
OK |
GNU C++14 |
TESTS |
60 |
311 |
55091200 |
|
2600 |
53564491 |
fblogy |
F |
April 30, 2019, 11:39 a.m. |
OK |
GNU C++14 |
TESTS |
60 |
327 |
34713600 |
|
2600 |
46198416 |
U_U |
F |
Nov. 25, 2018, 9:46 a.m. |
OK |
GNU C++14 |
TESTS |
60 |
327 |
53657600 |
|
2600 |
45941913 |
Batrr |
F |
Nov. 18, 2018, 8:06 p.m. |
OK |
GNU C++14 |
TESTS |
60 |
358 |
32256000 |
|
2600 |
46296328 |
Xin-Jie |
F |
Nov. 28, 2018, 3:14 a.m. |
OK |
GNU C++14 |
TESTS |
60 |
374 |
46284800 |
|
2600 |
47536869 |
ddpag |
F |
Dec. 27, 2018, 3:04 a.m. |
OK |
GNU C++17 |
TESTS |
60 |
218 |
32051200 |
|
2600 |
51117371 |
vjudge3 |
F |
March 10, 2019, 7:36 a.m. |
OK |
GNU C++17 |
TESTS |
60 |
280 |
33177600 |
|
2600 |
66598355 |
PlatinumDisco |
F |
Dec. 10, 2019, 3:33 p.m. |
OK |
GNU C++17 |
TESTS |
60 |
296 |
40550400 |
|
2600 |
51244002 |
jiangtao |
F |
March 13, 2019, 2:45 a.m. |
OK |
GNU C++17 |
TESTS |
60 |
296 |
46284800 |
|
2600 |
46909744 |
arock |
F |
Dec. 11, 2018, 4:13 p.m. |
OK |
GNU C++17 |
TESTS |
60 |
327 |
51097600 |
|
2600 |
46910558 |
arock |
F |
Dec. 11, 2018, 4:41 p.m. |
OK |
GNU C++17 |
TESTS |
60 |
342 |
51097600 |
|
2600 |
46910497 |
arock |
F |
Dec. 11, 2018, 4:39 p.m. |
OK |
GNU C++17 |
TESTS |
60 |
358 |
51097600 |
|
2600 |
46909700 |
arock |
F |
Dec. 11, 2018, 4:12 p.m. |
OK |
GNU C++17 |
TESTS |
60 |
358 |
55808000 |
|
2600 |
60242642 |
Bohun |
F |
Sept. 7, 2019, 10:45 p.m. |
OK |
GNU C++17 |
TESTS |
60 |
405 |
40550400 |
|
2600 |
61777378 |
hjk1030 |
F |
Oct. 3, 2019, 12:06 p.m. |
OK |
GNU C++17 |
TESTS |
60 |
405 |
59392000 |
|
2600 |
remove filters
Back to search problems