Codeforces Round 331 (Div. 2)

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
596 Codeforces Round 331 (Div. 2) FINISHED False 7200 328800323 Nov. 15, 2015, 4:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 728 ) D Wilbur and Trees PROGRAMMING dp math probabilities sortings 2500

Wilbur the pig really wants to be a beaver, so he decided today to pretend he is a beaver and bite at trees to cut them down. There are n trees located at various positions on a line. Tree i is located at position x i . All the given positions of the trees are distinct. The trees are equal, i.e. each tree has height h . Due to the wind, when a tree is cut down, it either falls left with probability p , or falls right with probability 1 - p . If a tree hits another tree while falling, that tree will fall in the same direction as the tree that hit it. A tree can hit another tree only if the distance between them is strictly less than h . For example, imagine there are 4 trees located at positions 1 , 3 , 5 and 8 , while h = 3 and the tree at position 1 falls right. It hits the tree at position 3 and it starts to fall too. In it's turn it hits the tree at position 5 and it also starts to fall. The distance between 8 and 5 is exactly 3 , so the tree at position 8 will not fall. As long as there are still trees standing, Wilbur will select either the leftmost standing tree with probability 0.5 or the rightmost standing tree with probability 0.5 . Selected tree is then cut down. If there is only one tree remaining, Wilbur always selects it. As the ground is covered with grass, Wilbur wants to know the expected total length of the ground covered with fallen trees after he cuts them all down because he is concerned about his grass-eating cow friends. Please help Wilbur. The first line of the input contains two integers, n (1 ≤ n ≤ 2000) and h (1 ≤ h ≤ 10 8 ) and a real number p ( 0 ≤ p ≤ 1 ), given with no more than six decimal places. The second line of the input contains n integers, x 1 , x 2 , ..., x n ( - 10 8 ≤ x i ≤ 10 8 ) in no particular order. Print a single real number — the expected total length of the ground covered by trees when they have all fallen down. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6 .

Tutorials

Codeforces Round #331 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
14284132 gen D Nov. 15, 2015, 6:02 p.m. OK GNU C++ TESTS 95 109 96665600 2500
26688850 Anti_Nhi_Thuan D April 26, 2017, 5:22 p.m. OK GNU C++ TESTS 95 124 130969600 2500
14293246 ShineRain D Nov. 16, 2015, 5:41 a.m. OK GNU C++ TESTS 95 124 193433600 2500
24480680 vjudge5 D Feb. 7, 2017, 4:07 a.m. OK GNU C++ TESTS 95 140 131276800 2500
27731088 Scut82 D June 12, 2017, 5:02 a.m. OK GNU C++ TESTS 95 140 142950400 2500
14286160 Melnyk D Nov. 15, 2015, 6:28 p.m. OK GNU C++ TESTS 95 155 124006400 2500
24480742 TangentOfA D Feb. 7, 2017, 4:14 a.m. OK GNU C++ TESTS 95 155 131276800 2500
14286251 IGandWFin2019 D Nov. 15, 2015, 6:29 p.m. OK GNU C++ TESTS 95 171 196300800 2500
19601207 NguyenKhoiDinh D Aug. 3, 2016, 3:56 p.m. OK GNU C++ TESTS 95 186 130355200 2500
14302924 Simeon98 D Nov. 16, 2015, 7:14 p.m. OK GNU C++ TESTS 95 187 128512000 2500
14307336 HellKitsune D Nov. 17, 2015, 3:28 a.m. OK GNU C++11 TESTS 95 62 128307200 2500
14347182 _just4fun_ D Nov. 19, 2015, 5:30 p.m. OK GNU C++11 TESTS 95 93 128921600 2500
14305206 HellKitsune D Nov. 17, 2015, 1:05 a.m. OK GNU C++11 TESTS 95 93 257024000 2500
40985795 ReaLNero1 D July 30, 2018, 8:10 p.m. OK GNU C++11 TESTS 95 93 257331200 2500
14287401 felix D Nov. 15, 2015, 6:59 p.m. OK GNU C++11 TESTS 95 93 257331200 2500
14413209 gvaibhav22 D Nov. 22, 2015, 11:56 a.m. OK GNU C++11 TESTS 95 108 129536000 2500
14284435 sharph D Nov. 15, 2015, 6:05 p.m. OK GNU C++11 TESTS 95 108 134553600 2500
14279737 memset123 D Nov. 15, 2015, 5:17 p.m. OK GNU C++11 TESTS 95 109 128921600 2500
14342697 fadeeva.kate.22.03 D Nov. 19, 2015, 1:51 p.m. OK GNU C++11 TESTS 95 124 129638400 2500
14288935 Luqman D Nov. 15, 2015, 8:04 p.m. OK GNU C++11 TESTS 95 155 129024000 2500
28008308 barsa492 D June 24, 2017, 3:59 p.m. OK GNU C++14 TESTS 95 140 130867200 2500
35035865 bigcrunch D Feb. 7, 2018, 9:03 p.m. OK GNU C++14 TESTS 95 155 131481600 2500
59302056 nabid_anzum D Aug. 22, 2019, 3:50 p.m. OK GNU C++14 TESTS 95 171 64512000 2500
51152750 NotNight D March 11, 2019, 8:54 a.m. OK GNU C++14 TESTS 95 202 145715200 2500
63608757 Mouaz_Alkhodari D Oct. 27, 2019, 4:15 p.m. OK GNU C++14 TESTS 95 202 194764800 2500
22563807 meopass_0v0 D Nov. 28, 2016, 3:54 a.m. OK GNU C++14 TESTS 95 218 178278400 2500
61443478 zeus_iitg D Sept. 28, 2019, 7:51 p.m. OK GNU C++14 TESTS 95 233 129740800 2500
26525469 rawatds D April 20, 2017, 7:46 p.m. OK GNU C++14 TESTS 95 234 130867200 2500
21005366 I_Love_Rem D Sept. 30, 2016, 1:59 a.m. OK GNU C++14 TESTS 95 234 147353600 2500
44579052 The-Legend D Oct. 20, 2018, 8:03 a.m. OK GNU C++14 TESTS 95 248 129126400 2500
49912331 ivan100sic D Feb. 14, 2019, 2:48 p.m. OK GNU C++17 TESTS 95 155 193331200 2500
64101454 igba D Nov. 2, 2019, 3:36 p.m. OK GNU C++17 TESTS 95 233 147353600 2500
64717479 Phortox D Nov. 11, 2019, 11:48 p.m. OK GNU C++17 TESTS 95 249 128716800 2500
67908080 ruo D Dec. 29, 2019, 3:13 p.m. OK GNU C++17 TESTS 95 249 129126400 2500
57326540 aviroop123 D July 19, 2019, 12:22 p.m. OK GNU C++17 TESTS 95 249 129331200 2500
35716994 DarkMomo D Feb. 26, 2018, 1:39 a.m. OK GNU C++17 TESTS 95 249 130969600 2500
38386561 JZmster D May 18, 2018, 2:20 a.m. OK GNU C++17 TESTS 95 249 155340800 2500
40586557 Doriath D July 20, 2018, 6:04 p.m. OK GNU C++17 TESTS 95 296 129126400 2500
63726998 k0walsk1 D Oct. 29, 2019, 12:57 p.m. OK GNU C++17 TESTS 95 358 194560000 2500
39938184 samuraiexx D July 3, 2018, 11:56 p.m. OK GNU C++17 TESTS 95 373 193024000 2500
15164809 riversouther D Jan. 3, 2016, 5:24 a.m. OK Java 7 TESTS 95 576 178790400 2500
14653857 gpita D Dec. 4, 2015, 7:24 p.m. OK Java 7 TESTS 95 623 178892800 2500
15164905 riversouther D Jan. 3, 2016, 5:40 a.m. OK Java 7 TESTS 95 624 178790400 2500
14304970 uwi D Nov. 17, 2015, 12:04 a.m. OK Java 8 TESTS 95 404 132403200 2500
14334374 mkirsche D Nov. 18, 2015, 9:51 p.m. OK Java 8 TESTS 95 436 127385600 2500
14281498 liymsheep D Nov. 15, 2015, 5:33 p.m. OK Java 8 TESTS 95 468 128000000 2500
14498853 mashinist D Nov. 26, 2015, 7:42 p.m. OK Java 8 TESTS 95 483 131584000 2500
14285419 Sumeet.Varma D Nov. 15, 2015, 6:18 p.m. OK Java 8 TESTS 95 514 131993600 2500
14655388 I_Need_Alex_R_Coleman D Dec. 4, 2015, 10:43 p.m. OK Java 8 TESTS 95 545 132096000 2500
16037772 raggzy D Feb. 15, 2016, 5:51 p.m. OK Java 8 TESTS 95 545 166604800 2500
14313453 nmakarov D Nov. 17, 2015, 1:44 p.m. OK Java 8 TESTS 95 561 132198400 2500
14288298 Fdg D Nov. 15, 2015, 7:26 p.m. OK Java 8 TESTS 95 576 132300800 2500
14295137 Ruins D Nov. 16, 2015, 9:07 a.m. OK Java 8 TESTS 95 592 131584000 2500
15574700 IPRIT D Jan. 25, 2016, 2:04 p.m. OK MS C# TESTS 95 576 131993600 2500
15574646 Ponies D Jan. 25, 2016, 2:01 p.m. OK MS C# TESTS 95 577 131891200 2500
15577267 IPRIT D Jan. 25, 2016, 4 p.m. OK MS C# TESTS 95 577 131993600 2500
14290486 azukun D Nov. 15, 2015, 11:06 p.m. OK MS C# TESTS 95 592 131891200 2500
15623758 IPRIT D Jan. 28, 2016, 6:27 a.m. OK MS C# TESTS 95 592 131993600 2500
15577091 -1- D Jan. 25, 2016, 3:52 p.m. OK MS C# TESTS 95 592 131993600 2500
15576030 IPRIT D Jan. 25, 2016, 3:03 p.m. OK MS C# TESTS 95 607 131993600 2500
15574729 Ponies D Jan. 25, 2016, 2:05 p.m. OK MS C# TESTS 95 607 131993600 2500
15623769 IPRIT D Jan. 28, 2016, 6:28 a.m. OK MS C# TESTS 95 623 131891200 2500
15576755 IPRIT D Jan. 25, 2016, 3:34 p.m. OK MS C# TESTS 95 623 131993600 2500
14302252 Mano D Nov. 16, 2015, 6:20 p.m. OK MS C++ TESTS 95 171 128512000 2500
14297879 Mushegh D Nov. 16, 2015, 1:05 p.m. OK MS C++ TESTS 95 234 144691200 2500
14313063 Carups D Nov. 17, 2015, 1:19 p.m. OK MS C++ TESTS 95 249 192921600 2500
16013394 sister_what_hate_most D Feb. 14, 2016, 6:12 a.m. OK MS C++ TESTS 95 280 129638400 2500
15926495 vjudge3 D Feb. 10, 2016, 8:58 a.m. OK MS C++ TESTS 95 280 129638400 2500
14288014 NVAL D Nov. 15, 2015, 7:15 p.m. OK MS C++ TESTS 95 280 131276800 2500
14291916 repeatuntil0 D Nov. 16, 2015, 2:11 a.m. OK MS C++ TESTS 95 296 129228800 2500
19613858 vjudge1 D Aug. 4, 2016, 11:11 a.m. OK MS C++ TESTS 95 311 129024000 2500
14286217 AleksanderBalobanov D Nov. 15, 2015, 6:29 p.m. OK MS C++ TESTS 95 311 129536000 2500
14354650 wRabbits_AlMag D Nov. 20, 2015, 6:29 a.m. OK MS C++ TESTS 95 312 144896000 2500
14352196 abdelsalmelsbae D Nov. 19, 2015, 10:27 p.m. OK Ocaml TESTS 95 639 131686400 2500
14352020 Darooha D Nov. 19, 2015, 10 p.m. OK Ocaml TESTS 95 670 131686400 2500
14326203 Darooha D Nov. 18, 2015, 12:52 p.m. OK Ocaml TESTS 95 982 131686400 2500

remove filters

Back to search problems