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"Today is Mashtali's birthday! He received a Hagh tree from Haj Davood as his birthday present! A directed tree is called a Hagh tree iff: After opening his gift, Mashtali found out that the labels on the vertices were gone. Immediately, he asked himself: how many different unlabeled Hagh trees are there? That is, how many possible trees could he have received as his birthday present? At the first glance, the number of such trees seemed to be infinite since there was no limit on the number of vertices; but then he solved the problem and proved that there's a finite number of unlabeled Hagh trees! Amazed by this fact, he shared the task with you so that you could enjoy solving it as well. Since the answer can be rather large he asked you to find the number of different unlabeled Hagh trees modulo 998244353 . Here two trees are considered different, if they are not isomorphic: if there is no way to map nodes of one tree to the second tree, so that edges are mapped to edges preserving the orientation. Some examples for n = 2 : Directed trees D and E are Hagh. C is not Hagh because it has a vertex with 4 edges attached to it. A and B are not Hagh because their longest directed paths are not equal to n . Also in B the leftmost and rightmost vertices are not friends neither do they have a mutual friend. The first line of input contains a single integer n (1 <= n <= 10^6) . Print a single integer, the answer to Mashtali's task modulo 998244353 . All the five Hagh trees for n = 1 : "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
117281298 |
deafff |
E |
May 25, 2021, 4:19 a.m. |
OK |
GNU C++11 |
TESTS |
21 |
46 |
11980800 |
|
|
117245905 |
gisp_zjz |
E |
May 24, 2021, 4:31 p.m. |
OK |
GNU C++11 |
TESTS |
21 |
61 |
16076800 |
|
|
117239904 |
dengyaotriangle |
E |
May 24, 2021, 4:12 p.m. |
OK |
GNU C++11 |
TESTS |
21 |
62 |
7987200 |
|
|
117254491 |
duality |
E |
May 24, 2021, 5:22 p.m. |
OK |
GNU C++11 |
TESTS |
21 |
77 |
15974400 |
|
|
117254150 |
LJC00118 |
E |
May 24, 2021, 5:20 p.m. |
OK |
GNU C++11 |
TESTS |
21 |
78 |
16076800 |
|
|
117251690 |
crasysky |
E |
May 24, 2021, 4:48 p.m. |
OK |
GNU C++11 |
TESTS |
21 |
93 |
11980800 |
|
|
117276112 |
HJKL1018 |
E |
May 25, 2021, 2:30 a.m. |
OK |
GNU C++11 |
TESTS |
21 |
93 |
20070400 |
|
|
117248171 |
-skyline- |
E |
May 24, 2021, 4:38 p.m. |
OK |
GNU C++11 |
TESTS |
21 |
93 |
32051200 |
|
|
117238423 |
Isonan |
E |
May 24, 2021, 4:08 p.m. |
OK |
GNU C++11 |
TESTS |
21 |
436 |
7782400 |
|
|
117244315 |
ugly2333 |
E |
May 24, 2021, 4:26 p.m. |
OK |
GNU C++14 |
TESTS |
21 |
77 |
13414400 |
|
|
117248860 |
krijgertje |
E |
May 24, 2021, 4:40 p.m. |
OK |
GNU C++14 |
TESTS |
21 |
78 |
7987200 |
|
|
117224989 |
peehs_moorhsum |
E |
May 24, 2021, 3:36 p.m. |
OK |
GNU C++14 |
TESTS |
21 |
124 |
32051200 |
|
|
117222959 |
Radewoosh |
E |
May 24, 2021, 3:32 p.m. |
OK |
GNU C++14 |
TESTS |
21 |
171 |
32256000 |
|
|
117248959 |
dlalswp25 |
E |
May 24, 2021, 4:40 p.m. |
OK |
GNU C++14 |
TESTS |
21 |
499 |
32358400 |
|
|
117250175 |
DmitryGrigorev |
E |
May 24, 2021, 4:44 p.m. |
OK |
GNU C++14 |
TESTS |
21 |
545 |
16076800 |
|
|
117278047 |
189X1A05B3 |
E |
May 25, 2021, 3:12 a.m. |
OK |
GNU C++17 |
TESTS |
21 |
46 |
3993600 |
|
|
117248498 |
never_giveup |
E |
May 24, 2021, 4:39 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
46 |
16076800 |
|
|
117239895 |
xtqqwq |
E |
May 24, 2021, 4:12 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
61 |
7987200 |
|
|
117272002 |
Kininarimasu |
E |
May 24, 2021, 11:54 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
61 |
24064000 |
|
|
117240173 |
Golovanov399 |
E |
May 24, 2021, 4:13 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
62 |
4505600 |
|
|
117271213 |
fivefourthreeone |
E |
May 24, 2021, 11:12 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
62 |
24064000 |
|
|
117268512 |
Nanored |
E |
May 24, 2021, 9:16 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
77 |
7987200 |
|
|
117238176 |
semiexp |
E |
May 24, 2021, 4:08 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
77 |
12083200 |
|
|
117276160 |
SunshinePie |
E |
May 25, 2021, 2:32 a.m. |
OK |
GNU C++17 |
TESTS |
21 |
78 |
32051200 |
|
|
117278940 |
SHZhang2 |
E |
May 25, 2021, 3:31 a.m. |
OK |
GNU C++17 |
TESTS |
21 |
93 |
15974400 |
|
|
117274908 |
AutumnKite |
E |
May 25, 2021, 1:55 a.m. |
OK |
GNU C++17 (64) |
TESTS |
21 |
30 |
3993600 |
|
|
117238399 |
noshi91 |
E |
May 24, 2021, 4:08 p.m. |
OK |
GNU C++17 (64) |
TESTS |
21 |
30 |
7987200 |
|
|
117240625 |
yhx-12243 |
E |
May 24, 2021, 4:14 p.m. |
OK |
GNU C++17 (64) |
TESTS |
21 |
31 |
7987200 |
|
|
117226469 |
jiangly |
E |
May 24, 2021, 3:40 p.m. |
OK |
GNU C++17 (64) |
TESTS |
21 |
31 |
7987200 |
|
|
117249069 |
mango_lassi |
E |
May 24, 2021, 4:40 p.m. |
OK |
GNU C++17 (64) |
TESTS |
21 |
31 |
24064000 |
|
|
117269667 |
SSRS_ |
E |
May 24, 2021, 9:54 p.m. |
OK |
GNU C++17 (64) |
TESTS |
21 |
46 |
7987200 |
|
|
117246132 |
SoMuchDrama |
E |
May 24, 2021, 4:31 p.m. |
OK |
GNU C++17 (64) |
TESTS |
21 |
46 |
7987200 |
|
|
117243560 |
hitonanode |
E |
May 24, 2021, 4:23 p.m. |
OK |
GNU C++17 (64) |
TESTS |
21 |
46 |
7987200 |
|
|
117268145 |
kotatsugame |
E |
May 24, 2021, 9:04 p.m. |
OK |
GNU C++17 (64) |
TESTS |
21 |
46 |
8396800 |
|
|
117249672 |
nocriz |
E |
May 24, 2021, 4:42 p.m. |
OK |
GNU C++17 (64) |
TESTS |
21 |
46 |
8396800 |
|
|
117256215 |
uwi |
E |
May 24, 2021, 5:34 p.m. |
OK |
Java 11 |
TESTS |
21 |
311 |
16691200 |
|
|
remove filters
Back to search problems