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'Little Petya likes trees a lot. Recently his mother has presented him a tree with 2n nodes. Petya immediately decided to place this tree on a rectangular table consisting of 2 rows and n columns so as to fulfill the following conditions: Now Petya wonders how many ways are there to place his tree on the table. He calls two placements distinct if there is a tree node which corresponds to distinct table cells in these two placements. Since large numbers can scare Petya, print the answer modulo 1000000007 (109 xe2 x80 x89+ xe2 x80 x897). The first line contains a single integer n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105). Next (2n xe2 x80 x89- xe2 x80 x891) lines contain two integers each ai and bi (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ai, xe2 x80 x89bi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x892n; ai xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89bi) that determine the numbers of the vertices connected by the corresponding edge. Consider the tree vertexes numbered by integers from 1 to 2n. It is guaranteed that the graph given in the input is a tree, that is, a connected acyclic undirected graph. Print a single integer -- the required number of ways to place the tree on the table modulo 1000000007 (109 xe2 x80 x89+ xe2 x80 x897). Note to the first sample (all 12 variants to place the tree on the table are given below):'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
29433788 |
owen_creeper |
E |
Aug. 13, 2017, 12:37 p.m. |
OK |
GNU C++ |
TESTS |
84 |
248 |
18944000 |
|
3000 |
25294059 |
Jin_Haonan |
E |
March 6, 2017, 1:51 p.m. |
OK |
GNU C++ |
TESTS |
84 |
248 |
24678400 |
|
3000 |
40990416 |
ReaLNero1 |
E |
July 30, 2018, 11:54 p.m. |
OK |
GNU C++ |
TESTS |
84 |
280 |
16793600 |
|
3000 |
25771274 |
cuibst2 |
E |
March 24, 2017, 11:47 a.m. |
OK |
GNU C++ |
TESTS |
84 |
312 |
24268800 |
|
3000 |
8060222 |
SkyDec |
E |
Oct. 2, 2014, 3:26 p.m. |
OK |
GNU C++ |
TESTS |
84 |
342 |
20480000 |
|
3000 |
10429392 |
neetenin |
E |
March 25, 2015, 6:30 a.m. |
OK |
GNU C++ |
TESTS |
84 |
342 |
23040000 |
|
3000 |
11337807 |
Amr_Hassan |
E |
May 28, 2015, 7:19 p.m. |
OK |
GNU C++ |
TESTS |
84 |
342 |
23142400 |
|
3000 |
8034255 |
wjh720 |
E |
Sept. 30, 2014, 9:21 a.m. |
OK |
GNU C++ |
TESTS |
84 |
342 |
23244800 |
|
3000 |
9741129 |
meikoNiMaBi |
E |
Feb. 7, 2015, 12:19 a.m. |
OK |
GNU C++ |
TESTS |
84 |
342 |
81715200 |
|
3000 |
2853596 |
nju_v_o_f |
E |
Dec. 29, 2012, 12:55 p.m. |
OK |
GNU C++ |
TESTS |
84 |
343 |
21708800 |
|
3000 |
9273489 |
equation314 |
E |
Dec. 26, 2014, 7:34 a.m. |
OK |
GNU C++0x |
TESTS |
84 |
374 |
18227200 |
|
3000 |
8933276 |
zhj |
E |
Dec. 2, 2014, 2:34 p.m. |
OK |
GNU C++0x |
TESTS |
84 |
374 |
21504000 |
|
3000 |
8347499 |
jiry_2 |
E |
Oct. 22, 2014, 2:39 a.m. |
OK |
GNU C++0x |
TESTS |
84 |
404 |
27136000 |
|
3000 |
2749813 |
gogaruspro |
E |
Dec. 11, 2012, 6:47 a.m. |
OK |
GNU C++0x |
TESTS |
84 |
421 |
20480000 |
|
3000 |
50214097 |
cx233666 |
E |
Feb. 20, 2019, 2:57 a.m. |
OK |
GNU C++11 |
TESTS |
84 |
278 |
22220800 |
|
3000 |
50214163 |
luogu_bot5 |
E |
Feb. 20, 2019, 2:59 a.m. |
OK |
GNU C++11 |
TESTS |
84 |
280 |
22220800 |
|
3000 |
50229959 |
luogu_bot1 |
E |
Feb. 20, 2019, 8:49 a.m. |
OK |
GNU C++11 |
TESTS |
84 |
280 |
26419200 |
|
3000 |
41246156 |
zhouyuyang |
E |
Aug. 5, 2018, 1:13 p.m. |
OK |
GNU C++11 |
TESTS |
84 |
310 |
23654400 |
|
3000 |
26487499 |
vjudge2 |
E |
April 19, 2017, 3:40 a.m. |
OK |
GNU C++11 |
TESTS |
84 |
342 |
30208000 |
|
3000 |
57898260 |
lopare |
E |
July 28, 2019, 2:32 p.m. |
OK |
GNU C++11 |
TESTS |
84 |
404 |
18124800 |
|
3000 |
57821712 |
py_ultron |
E |
July 26, 2019, 11:55 p.m. |
OK |
GNU C++11 |
TESTS |
84 |
404 |
18124800 |
|
3000 |
35855289 |
______u______ |
E |
March 2, 2018, 7:58 p.m. |
OK |
GNU C++11 |
TESTS |
84 |
404 |
20070400 |
|
3000 |
35855010 |
______n______ |
E |
March 2, 2018, 7:52 p.m. |
OK |
GNU C++11 |
TESTS |
84 |
404 |
20070400 |
|
3000 |
35854547 |
_____i_____ |
E |
March 2, 2018, 7:44 p.m. |
OK |
GNU C++11 |
TESTS |
84 |
404 |
20070400 |
|
3000 |
37916983 |
thchuan |
E |
May 6, 2018, 1:58 a.m. |
OK |
GNU C++14 |
TESTS |
84 |
436 |
52326400 |
|
3000 |
56165090 |
Scut82 |
E |
June 27, 2019, 1:57 p.m. |
OK |
GNU C++14 |
TESTS |
84 |
466 |
17510400 |
|
3000 |
37909489 |
thchuan |
E |
May 5, 2018, 2:54 p.m. |
OK |
GNU C++14 |
TESTS |
84 |
496 |
52326400 |
|
3000 |
26110071 |
RemiliaScarlet |
E |
April 3, 2017, 11:38 p.m. |
OK |
GNU C++14 |
TESTS |
84 |
498 |
31334400 |
|
3000 |
38127836 |
little_waxberry |
E |
May 12, 2018, 4:49 a.m. |
OK |
GNU C++14 |
TESTS |
84 |
560 |
29900800 |
|
3000 |
23662184 |
Ali.Pi |
E |
Jan. 9, 2017, 8:02 a.m. |
OK |
GNU C++14 |
TESTS |
84 |
622 |
21401600 |
|
3000 |
54484217 |
Isonan |
E |
May 22, 2019, 12:21 p.m. |
OK |
GNU C++17 |
TESTS |
84 |
468 |
135065600 |
|
3000 |
42437467 |
teapotd |
E |
Sept. 3, 2018, 6:12 p.m. |
OK |
GNU C++17 |
TESTS |
84 |
1246 |
138956800 |
|
3000 |
64772460 |
Xellos |
E |
Nov. 13, 2019, 1:19 a.m. |
OK |
GNU C++17 |
TESTS |
84 |
1776 |
109568000 |
|
3000 |
64772284 |
Xellos |
E |
Nov. 13, 2019, 1:07 a.m. |
OK |
GNU C++17 |
TESTS |
84 |
1994 |
109568000 |
|
3000 |
remove filters
Back to search problems