Codeforces Round 172 (Div. 1)

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.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
280 Codeforces Round 172 (Div. 1) FINISHED False 7200 374250563 March 10, 2013, 3:30 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 4218 ) C Game on Tree PROGRAMMING implementation math probabilities trees 2400

B"Momiji has got a rooted tree, consisting of n nodes. The tree nodes are numbered by integers from 1 to n. The root has number 1. Momiji decided to play a game on this tree. The game consists of several steps. On each step, Momiji chooses one of the remaining tree nodes (let's denote it by v) and removes all the subtree nodes with the root in node v from the tree. Node v gets deleted as well. The game finishes when the tree has no nodes left. In other words, the game finishes after the step that chooses the node number 1. Each time Momiji chooses a new node uniformly among all the remaining nodes. Your task is to find the expectation of the number of steps in the described game. The first line contains integer n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105) -- the number of nodes in the tree. The next n xe2 x80 x89- xe2 x80 x891 lines contain the tree edges. The i-th line contains integers ai, bi (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ai, xe2 x80 x89bi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n; ai xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89bi) -- the numbers of the nodes that are connected by the i-th edge. It is guaranteed that the given graph is a tree. Print a single real number -- the expectation of the number of steps in the described game. The answer will be considered correct if the absolute or relative error doesn't exceed 10 xe2 x80 x89- xe2 x80 x896. In the first sample, there are two cases. One is directly remove the root and another is remove the root after one step. Thus the expected steps are: In the second sample, things get more complex. There are two cases that reduce to the first sample, and one case cleaned at once. Thus the expected steps are: "...

Tutorials

T

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
3276846 Gassa C March 10, 2013, 3:53 p.m. OK D TESTS 52 250 7270400 2400
3284654 Gassa C March 10, 2013, 6:28 p.m. OK D TESTS 52 328 7270400 2400
3728168 MrJigan1488 C May 16, 2013, 6:45 p.m. OK Delphi TESTS 52 46 34201600 2400
3419903 AleksanderBalobanov C March 29, 2013, 3:50 p.m. OK Delphi TESTS 52 62 9420800 2400
3291655 Misha100896 C March 11, 2013, 6:21 p.m. OK Delphi TESTS 52 62 13004800 2400
3296196 vlad107 C March 12, 2013, 7:18 p.m. OK FPC TESTS 52 46 8396800 2400
3289098 Rubanenko C March 11, 2013, 10:36 a.m. OK FPC TESTS 52 62 4812800 2400
3452242 Furko C April 2, 2013, 9:34 a.m. OK FPC TESTS 52 62 14438400 2400
3322248 vilcheuski C March 15, 2013, 5:02 p.m. OK FPC TESTS 52 78 8089600 2400
20193455 Ahriman C Aug. 27, 2016, 10:57 a.m. OK FPC TESTS 52 92 10035200 2400
44759673 luogu_bot4 C Oct. 24, 2018, 6:17 a.m. OK FPC TESTS 52 154 4096000 2400
3356784 pedja C March 19, 2013, 12:51 p.m. OK GNU C TESTS 52 78 11776000 2400
19563752 Piddnad1 C Aug. 1, 2016, 3:28 p.m. OK GNU C TESTS 52 92 7168000 2400
3293626 JohnDeVostok C March 12, 2013, 9 a.m. OK GNU C++ TESTS 52 15 5529600 2400
3296723 bakabakashyoshyo C March 13, 2013, 12:45 a.m. OK GNU C++ TESTS 52 15 23244800 2400
5449678 diamondlx C Dec. 16, 2013, 11:12 a.m. OK GNU C++ TESTS 52 30 5632000 2400
23615620 vjudge1 C Jan. 7, 2017, 2:49 a.m. OK GNU C++ TESTS 52 30 7884800 2400
33039365 vjudge4 C Dec. 9, 2017, 3:13 a.m. OK GNU C++ TESTS 52 30 10035200 2400
4033351 xy666 C July 7, 2013, 5:57 a.m. OK GNU C++ TESTS 52 31 2764800 2400
3314159 zhangyiyin C March 14, 2013, 6:17 a.m. OK GNU C++ TESTS 52 31 7577600 2400
3288458 RsEnts C March 11, 2013, 8:03 a.m. OK GNU C++ TESTS 52 46 5017600 2400
3502777 LXLWDGY C April 11, 2013, 9:49 a.m. OK GNU C++ TESTS 52 46 5632000 2400
3429603 sokian C April 1, 2013, 6:35 a.m. OK GNU C++ TESTS 52 46 7680000 2400
3286938 htc550605125 C March 11, 2013, 12:19 a.m. OK GNU C++0x TESTS 52 31 5324800 2400
3290892 lcch C March 11, 2013, 3:36 p.m. OK GNU C++0x TESTS 52 62 6451200 2400
3381777 savinov C March 22, 2013, 4:40 p.m. OK GNU C++0x TESTS 52 62 7680000 2400
3660159 BryantMark C May 2, 2013, 12:04 p.m. OK GNU C++0x TESTS 52 78 9932800 2400
6600301 moh.amr C May 11, 2014, 11:17 p.m. OK GNU C++0x TESTS 52 92 3686400 2400
8937306 a654889339 C Dec. 2, 2014, 4:24 p.m. OK GNU C++0x TESTS 52 92 7168000 2400
6092732 alex_world C March 20, 2014, 4:26 p.m. OK GNU C++0x TESTS 52 92 9318400 2400
6641585 ikatanic C May 17, 2014, 9:53 a.m. OK GNU C++0x TESTS 52 92 9318400 2400
6193283 mrtempo C March 30, 2014, 8:09 p.m. OK GNU C++0x TESTS 52 92 9318400 2400
5767477 diego_v1 C Jan. 22, 2014, 12:38 a.m. OK GNU C++0x TESTS 52 92 9318400 2400
59502191 sjx233 C Aug. 26, 2019, 3:37 a.m. OK GNU C11 TESTS 52 92 7168000 2400
61560978 rainboy C Sept. 30, 2019, 3:32 p.m. OK GNU C11 TESTS 52 92 8396800 2400
30300530 Saramanda C Sept. 13, 2017, 6:45 a.m. OK GNU C++11 TESTS 52 30 5427200 2400
47609184 SuperFF C Dec. 28, 2018, 7:08 a.m. OK GNU C++11 TESTS 52 60 5529600 2400
23643125 vjudge4 C Jan. 8, 2017, 9:02 a.m. OK GNU C++11 TESTS 52 60 29593600 2400
58917418 luogu_bot2 C Aug. 16, 2019, 3:34 p.m. OK GNU C++11 TESTS 52 62 2457600 2400
57931244 SimonSU C July 29, 2019, 8:48 a.m. OK GNU C++11 TESTS 52 62 3584000 2400
57261259 luogu_bot5 C July 18, 2019, 5:17 a.m. OK GNU C++11 TESTS 52 62 3584000 2400
44697141 3fukin C Oct. 22, 2018, 1:23 p.m. OK GNU C++11 TESTS 52 62 3686400 2400
40869983 luogu_bot5 C July 28, 2018, 5:54 a.m. OK GNU C++11 TESTS 52 62 3686400 2400
63542997 luogu_bot2 C Oct. 27, 2019, 9:51 a.m. OK GNU C++11 TESTS 52 62 3686400 2400
63282144 shengzihang C Oct. 24, 2019, 9:03 a.m. OK GNU C++11 TESTS 52 62 3686400 2400
67147597 ElangBondol C Dec. 18, 2019, 9:29 a.m. OK GNU C++14 TESTS 52 92 5632000 2400
44760126 lunch C Oct. 24, 2018, 6:35 a.m. OK GNU C++14 TESTS 52 92 15052800 2400
52805769 QuartZ_Z C April 16, 2019, 4:15 a.m. OK GNU C++14 TESTS 52 122 5529600 2400
35985874 alimagde C March 6, 2018, 8:52 a.m. OK GNU C++14 TESTS 52 122 9113600 2400
34872457 murugappan_s C Feb. 2, 2018, 6:05 p.m. OK GNU C++14 TESTS 52 122 10035200 2400
51466406 vjudge5 C March 19, 2019, 2 a.m. OK GNU C++14 TESTS 52 122 12800000 2400
40931112 AcFeNg C July 30, 2018, 12:39 a.m. OK GNU C++14 TESTS 52 124 2150400 2400
63954395 _HossamYehia_ C Nov. 1, 2019, 12:09 a.m. OK GNU C++14 TESTS 52 124 3276800 2400
51842578 SKY_magician C March 26, 2019, 12:12 a.m. OK GNU C++14 TESTS 52 124 4915200 2400
60932882 tejasp919 C Sept. 20, 2019, 2:19 p.m. OK GNU C++14 TESTS 52 124 5017600 2400
64280357 Holmesee C Nov. 5, 2019, 1:16 a.m. OK GNU C++17 TESTS 52 92 10444800 2400
53655943 vjudge3 C May 2, 2019, 4:46 a.m. OK GNU C++17 TESTS 52 122 7168000 2400
58314683 ZhihuiLiu C Aug. 5, 2019, 2:12 a.m. OK GNU C++17 TESTS 52 124 4915200 2400
65906162 kostia244 C Nov. 28, 2019, 11 a.m. OK GNU C++17 TESTS 52 124 5836800 2400
69187518 vjudge1 C Jan. 20, 2020, 12:27 p.m. OK GNU C++17 TESTS 52 124 5939200 2400
69188846 EDawn C Jan. 20, 2020, 12:52 p.m. OK GNU C++17 TESTS 52 124 6041600 2400
43785654 hyfzbtrs C Oct. 4, 2018, 12:06 p.m. OK GNU C++17 TESTS 52 124 6348800 2400
42105769 zhaimingshuzms C Aug. 26, 2018, 12:16 a.m. OK GNU C++17 TESTS 52 124 6758400 2400
51954746 CMXRYNP C March 29, 2019, 12:44 a.m. OK GNU C++17 TESTS 52 124 6758400 2400
43337741 vjudge2 C Sept. 23, 2018, 4:42 p.m. OK GNU C++17 TESTS 52 124 7168000 2400
3280103 uwi C March 10, 2013, 4:29 p.m. OK Java 6 TESTS 52 125 0 2400
3295936 emo C March 12, 2013, 5:51 p.m. OK Java 6 TESTS 52 171 0 2400
3986616 Sammarize C June 28, 2013, 7:35 p.m. OK Java 6 TESTS 52 265 14131200 2400
3285206 hs484 C March 10, 2013, 6:49 p.m. OK Java 6 TESTS 52 265 19558400 2400
3286744 AlexanderBolshakov C March 10, 2013, 11:11 p.m. OK Java 6 TESTS 52 281 21401600 2400
3281999 piotr.kukla C March 10, 2013, 4:56 p.m. OK Java 6 TESTS 52 296 12697600 2400
3614687 hama-du C April 24, 2013, 2:52 a.m. OK Java 6 TESTS 52 312 6451200 2400
4099209 mkirsche C July 18, 2013, 12:41 p.m. OK Java 6 TESTS 52 312 11776000 2400
5404565 DiegoAE C Dec. 10, 2013, 4:11 p.m. OK Java 6 TESTS 52 404 37785600 2400
3278060 jonathanpaulson C March 10, 2013, 4:06 p.m. OK Java 6 TESTS 52 484 16384000 2400
3276855 Egor C March 10, 2013, 3:53 p.m. OK Java 7 TESTS 52 125 0 2400
3351003 ysyshtc C March 18, 2013, 12:10 p.m. OK Java 7 TESTS 52 187 6246400 2400
3275909 Petr C March 10, 2013, 3:40 p.m. OK Java 7 TESTS 52 203 102400 2400
3670071 Shapo C May 4, 2013, 6:37 p.m. OK Java 7 TESTS 52 250 12492800 2400
3282897 antonkov C March 10, 2013, 5:10 p.m. OK Java 7 TESTS 52 250 21094400 2400
3281707 chavit C March 10, 2013, 4:52 p.m. OK Java 7 TESTS 52 250 21094400 2400
3670063 Shapo C May 4, 2013, 6:34 p.m. OK Java 7 TESTS 52 265 12492800 2400
3280337 yaro C March 10, 2013, 4:33 p.m. OK Java 7 TESTS 52 265 20992000 2400
3276514 qwerty787788 C March 10, 2013, 3:48 p.m. OK Java 7 TESTS 52 265 21094400 2400
3278727 ilyakor C March 10, 2013, 4:13 p.m. OK Java 7 TESTS 52 265 42496000 2400
56106083 AryssonFigueiredo C June 26, 2019, 3:46 p.m. OK Java 8 TESTS 52 342 19148800 2400
38424340 PrakharJain C May 19, 2018, 9:01 a.m. OK Java 8 TESTS 52 374 10752000 2400
26803664 Kammola C May 2, 2017, 1:47 p.m. OK Java 8 TESTS 52 404 36249600 2400
61742009 ZeyadKhattab C Oct. 2, 2019, 8:47 p.m. OK Java 8 TESTS 52 404 37171200 2400
39509449 amnesiac_dusk C June 22, 2018, 8:07 a.m. OK Java 8 TESTS 52 434 15052800 2400
11115653 dhrumil140396 C May 16, 2015, 9:41 a.m. OK Java 8 TESTS 52 436 10956800 2400
43400276 aabdelzaher C Sept. 25, 2018, 8:11 a.m. OK Java 8 TESTS 52 498 35532800 2400
22278535 tbuzzelli C Nov. 16, 2016, 11:34 p.m. OK Java 8 TESTS 52 530 15360000 2400
61560977 Dukkha C Sept. 30, 2019, 3:32 p.m. OK Java 8 TESTS 52 716 4812800 2400
48958130 vjudge5 C Jan. 26, 2019, 5:31 a.m. OK Java 8 TESTS 52 842 25190400 2400
3297952 onigiri C March 13, 2013, 10:30 a.m. OK Mono C# TESTS 52 203 12697600 2400
3287969 BIT_silence C March 11, 2013, 6:13 a.m. OK MS C++ TESTS 52 46 6758400 2400
3284294 aa2985759 C March 10, 2013, 5:29 p.m. OK MS C++ TESTS 52 62 5324800 2400
28012987 handsomeIvan C June 24, 2017, 10:40 p.m. OK MS C++ TESTS 52 62 8499200 2400
3282475 AleX C March 10, 2013, 5:03 p.m. OK MS C++ TESTS 52 78 6144000 2400
3284540 Fasterm C March 10, 2013, 6:25 p.m. OK MS C++ TESTS 52 78 6553600 2400
3303253 ADJA C March 13, 2013, 4:02 p.m. OK MS C++ TESTS 52 78 6553600 2400
3281365 GlebsHP C March 10, 2013, 4:47 p.m. OK MS C++ TESTS 52 78 6860800 2400
3282983 Shef C March 10, 2013, 5:11 p.m. OK MS C++ TESTS 52 78 8601600 2400
3283118 Merkurev C March 10, 2013, 5:14 p.m. OK MS C++ TESTS 52 78 9420800 2400
51467003 vjudge4 C March 19, 2019, 2:42 a.m. OK MS C++ TESTS 52 92 2969600 2400
3416034 jhcmonroy C March 28, 2013, 2:29 p.m. OK Perl TESTS 52 703 82124800 2400
35857079 ______n______ C March 2, 2018, 8:33 p.m. OK Perl TESTS 52 842 114176000 2400
35857178 ______u______ C March 2, 2018, 8:34 p.m. OK Perl TESTS 52 842 114176000 2400
35856689 _____i_____ C March 2, 2018, 8:26 p.m. OK Perl TESTS 52 842 114176000 2400
35856315 _____k_____ C March 2, 2018, 8:17 p.m. OK Perl TESTS 52 842 114176000 2400
35847657 ______h______ C March 2, 2018, 4:46 p.m. OK Perl TESTS 52 842 114176000 2400
35847655 ______k______ C March 2, 2018, 4:46 p.m. OK Perl TESTS 52 842 114176000 2400
35847476 ______i______ C March 2, 2018, 4:45 p.m. OK Perl TESTS 52 842 114176000 2400
35842858 ______M______ C March 2, 2018, 3:01 p.m. OK Perl TESTS 52 842 114176000 2400
68299063 sophiebits C Jan. 6, 2020, 5:22 a.m. OK PyPy 3 TESTS 52 684 18944000 2400
68376448 Bovniova C Jan. 7, 2020, 8:13 p.m. OK PyPy 3 TESTS 52 716 19558400 2400
3423858 daidailanlan C March 30, 2013, 5:04 p.m. OK Python 2 TESTS 52 593 12288000 2400
3467491 codedr C April 3, 2013, 7:02 a.m. OK Python 2 TESTS 52 609 12288000 2400
3321715 CAPITAL C March 15, 2013, 3:02 p.m. OK Python 2 TESTS 52 640 12492800 2400
3320216 CAPITAL C March 15, 2013, 10:45 a.m. OK Python 2 TESTS 52 656 12492800 2400
3402719 UESTC_Nocturne C March 25, 2013, 7:49 a.m. OK Python 2 TESTS 52 671 12902400 2400
3766601 nealzane C May 24, 2013, 4:37 p.m. OK Python 2 TESTS 52 859 12083200 2400

remove filters

Back to search problems