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'You are given a rooted tree consisting of n vertices numbered from 1 to n . The root of the tree is the vertex 1 . You have to color all vertices of the tree into n colors (also numbered from 1 to n ) so that there is exactly one vertex for each color. Let c_i be the color of vertex i , and p_i be the parent of vertex i in the rooted tree. The coloring is considered beautiful if there is no vertex k ( k > 1 ) such that c_k = c_{p_k} - 1 , i. xe2 x80 x89e. no vertex such that its color is less than the color of its parent by exactly 1 . Calculate the number of beautiful colorings, and print it modulo 998244353 . The first line contains one integer n ( 2 <= n <= 250000 ) -- the number of vertices in the tree. Then n-1 lines follow, the i -th line contains two integers x_i and y_i ( 1 <= x_i, y_i <= n ; x_i ne y_i ) denoting an edge between the vertex x_i and the vertex y_i . These edges form a tree. Print one integer -- the number of beautiful colorings, taken modulo 998244353 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
137712471 |
AwakeAnay |
F |
Dec. 1, 2021, 5:20 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
1622 |
50688000 |
|
|
137744735 |
HNFMS_Lsk |
F |
Dec. 2, 2021, 4:58 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
2168 |
51916800 |
|
|
137742292 |
HNFMS_Lsk |
F |
Dec. 2, 2021, 4:13 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
2230 |
51916800 |
|
|
137707062 |
sleep__ |
F |
Dec. 1, 2021, 4:42 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
3463 |
25190400 |
|
|
137748120 |
realFZzzz |
F |
Dec. 2, 2021, 5:50 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
3478 |
11571200 |
|
|
137702733 |
StevenZhu |
F |
Dec. 1, 2021, 4:30 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
3572 |
56524800 |
|
|
137748482 |
Elegia |
F |
Dec. 2, 2021, 5:55 a.m. |
OK |
GNU C++17 |
TESTS |
51 |
264 |
27852800 |
|
|
137748102 |
Elegia |
F |
Dec. 2, 2021, 5:50 a.m. |
OK |
GNU C++17 |
TESTS |
51 |
343 |
34918400 |
|
|
137748170 |
Elegia |
F |
Dec. 2, 2021, 5:51 a.m. |
OK |
GNU C++17 |
TESTS |
51 |
405 |
44953600 |
|
|
137727756 |
Marckess |
F |
Dec. 1, 2021, 8:50 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
436 |
19251200 |
|
|
137738498 |
_October |
F |
Dec. 2, 2021, 2:48 a.m. |
OK |
GNU C++17 |
TESTS |
51 |
670 |
10854400 |
|
|
137739094 |
_October |
F |
Dec. 2, 2021, 3:02 a.m. |
OK |
GNU C++17 |
TESTS |
51 |
701 |
9216000 |
|
|
137739027 |
_October |
F |
Dec. 2, 2021, 3 a.m. |
OK |
GNU C++17 |
TESTS |
51 |
748 |
10752000 |
|
|
137739990 |
aniketspeaks |
F |
Dec. 2, 2021, 3:23 a.m. |
OK |
GNU C++17 |
TESTS |
51 |
888 |
41369600 |
|
|
137746958 |
Yzm007 |
F |
Dec. 2, 2021, 5:34 a.m. |
OK |
GNU C++17 |
TESTS |
51 |
1060 |
33382400 |
|
|
137734493 |
naitir |
F |
Dec. 2, 2021, 12:50 a.m. |
OK |
GNU C++17 |
TESTS |
51 |
1824 |
153292800 |
|
|
137736669 |
orzdevinwang |
F |
Dec. 2, 2021, 1:56 a.m. |
OK |
GNU C++17 (64) |
TESTS |
51 |
171 |
29388800 |
|
|
137736492 |
orzdevinwang |
F |
Dec. 2, 2021, 1:52 a.m. |
OK |
GNU C++17 (64) |
TESTS |
51 |
186 |
29388800 |
|
|
137736262 |
orzdevinwang |
F |
Dec. 2, 2021, 1:45 a.m. |
OK |
GNU C++17 (64) |
TESTS |
51 |
187 |
29388800 |
|
|
137736377 |
orzdevinwang |
F |
Dec. 2, 2021, 1:49 a.m. |
OK |
GNU C++17 (64) |
TESTS |
51 |
187 |
29388800 |
|
|
137736197 |
orzdevinwang |
F |
Dec. 2, 2021, 1:43 a.m. |
OK |
GNU C++17 (64) |
TESTS |
51 |
233 |
37785600 |
|
|
137749030 |
Elegia |
F |
Dec. 2, 2021, 6:02 a.m. |
OK |
GNU C++17 (64) |
TESTS |
51 |
233 |
49664000 |
|
|
137748528 |
Elegia |
F |
Dec. 2, 2021, 5:56 a.m. |
OK |
GNU C++17 (64) |
TESTS |
51 |
249 |
41267200 |
|
|
137736432 |
Elegia |
F |
Dec. 2, 2021, 1:50 a.m. |
OK |
GNU C++17 (64) |
TESTS |
51 |
280 |
100454400 |
|
|
137736312 |
Elegia |
F |
Dec. 2, 2021, 1:47 a.m. |
OK |
GNU C++17 (64) |
TESTS |
51 |
311 |
100454400 |
|
|
137740520 |
He_Ren |
F |
Dec. 2, 2021, 3:35 a.m. |
OK |
GNU C++17 (64) |
TESTS |
51 |
327 |
14336000 |
|
|
137736567 |
Elegia |
F |
Dec. 2, 2021, 1:54 a.m. |
OK |
GNU C++20 (64) |
TESTS |
51 |
295 |
100454400 |
|
|
137738405 |
Alan233 |
F |
Dec. 2, 2021, 2:45 a.m. |
OK |
GNU C++20 (64) |
TESTS |
51 |
311 |
76800000 |
|
|
137738421 |
Alan233 |
F |
Dec. 2, 2021, 2:46 a.m. |
OK |
GNU C++20 (64) |
TESTS |
51 |
311 |
76800000 |
|
|
137738311 |
Alan233 |
F |
Dec. 2, 2021, 2:43 a.m. |
OK |
GNU C++20 (64) |
TESTS |
51 |
342 |
76800000 |
|
|
137725076 |
_runtimeTerror_ |
F |
Dec. 1, 2021, 7:55 p.m. |
OK |
GNU C++20 (64) |
TESTS |
51 |
343 |
10342400 |
|
|
137735488 |
dXqwq |
F |
Dec. 2, 2021, 1:21 a.m. |
OK |
GNU C++20 (64) |
TESTS |
51 |
358 |
29388800 |
|
|
137717970 |
Boboge |
F |
Dec. 1, 2021, 6:15 p.m. |
OK |
GNU C++20 (64) |
TESTS |
51 |
390 |
25190400 |
|
|
137735356 |
dXqwq |
F |
Dec. 2, 2021, 1:18 a.m. |
OK |
GNU C++20 (64) |
TESTS |
51 |
451 |
33587200 |
|
|
137710625 |
yinwuxiao |
F |
Dec. 1, 2021, 5:05 p.m. |
OK |
GNU C++20 (64) |
TESTS |
51 |
498 |
128716800 |
|
|
137733163 |
Alan233 |
F |
Dec. 2, 2021, 12:02 a.m. |
OK |
GNU C++20 (64) |
TESTS |
51 |
529 |
70246400 |
|
|
137711274 |
mban259 |
F |
Dec. 1, 2021, 5:10 p.m. |
OK |
.NET Core C# |
TESTS |
51 |
2776 |
367513600 |
|
|
137721462 |
sansen |
F |
Dec. 1, 2021, 7 p.m. |
OK |
Rust 2021 |
TESTS |
51 |
420 |
35942400 |
|
|
137722127 |
sansen |
F |
Dec. 1, 2021, 7:09 p.m. |
OK |
Rust 2021 |
TESTS |
51 |
561 |
35942400 |
|
|
remove filters
Back to search problems