Codeforces Round 438 by Sberbank and Barcelona Bootcamp (Div. 1 + Div. 2 combined)

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
868 Codeforces Round 438 by Sberbank and Barcelona Bootcamp (Div. 1 + Div. 2 combined) FINISHED False 10800 269218523 Oct. 5, 2017, 7:05 a.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 171 ) G El Toll Caves PROGRAMMING math 3300

The prehistoric caves of El Toll are located in Moià (Barcelona). You have heard that there is a treasure hidden in one of n possible spots in the caves. You assume that each of the spots has probability 1 / n to contain a treasure. You cannot get into the caves yourself, so you have constructed a robot that can search the caves for treasure. Each day you can instruct the robot to visit exactly k distinct spots in the caves. If none of these spots contain treasure, then the robot will obviously return with empty hands. However, the caves are dark, and the robot may miss the treasure even when visiting the right spot. Formally, if one of the visited spots does contain a treasure, the robot will obtain it with probability 1 / 2 , otherwise it will return empty. Each time the robot searches the spot with the treasure, his success probability is independent of all previous tries (that is, the probability to miss the treasure after searching the right spot x times is 1 / 2 x ). What is the expected number of days it will take to obtain the treasure if you choose optimal scheduling for the robot? Output the answer as a rational number modulo 10 9 + 7 . Formally, let the answer be an irreducible fraction P / Q , then you have to output . It is guaranteed that Q is not divisible by 10 9 + 7 . The first line contains the number of test cases T ( 1 ≤ T ≤ 1000 ). Each of the next T lines contains two integers n and k ( 1 ≤ k ≤ n ≤ 5·10 8 ). For each test case output the answer in a separate line. In the first case the robot will repeatedly search in the only spot. The expected number of days in this case is 2. Note that in spite of the fact that we know the treasure spot from the start, the robot still has to search there until he succesfully recovers the treasure. In the second case the answer can be shown to be equal to 7 / 2 if we search the two spots alternatively. In the third case the answer is 25 / 9 .

Tutorials

55046

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
38825304 Drin_E G June 1, 2018, 10:51 a.m. OK GNU C++ TESTS 24 78 3481600 3300
40508260 PomperMan G July 18, 2018, 9:36 a.m. OK GNU C++ TESTS 24 109 0 3300
31150510 shanquan2 G Oct. 8, 2017, 5:04 p.m. OK GNU C++ TESTS 24 139 0 3300
31141964 MrLolthe1st G Oct. 8, 2017, 11:19 a.m. OK GNU C++ TESTS 24 139 0 3300
32136835 Georgia_001 G Nov. 8, 2017, 10:50 a.m. OK GNU C++ TESTS 24 140 0 3300
31150446 shanquan2 G Oct. 8, 2017, 5:01 p.m. OK GNU C++ TESTS 24 140 0 3300
31141771 shanquan2 G Oct. 8, 2017, 11:12 a.m. OK GNU C++ TESTS 24 140 0 3300
31472484 matthew99 G Oct. 18, 2017, 7:44 a.m. OK GNU C++11 TESTS 24 31 2048000 3300
40979572 ReaLNero1 G July 30, 2018, 5:08 p.m. OK GNU C++11 TESTS 24 46 0 3300
32145588 aurinegro G Nov. 8, 2017, 7:33 p.m. OK GNU C++11 TESTS 24 46 0 3300
48045327 samjia2000 G Jan. 7, 2019, 1:53 a.m. OK GNU C++11 TESTS 24 61 0 3300
31159891 black_horse2014 G Oct. 9, 2017, 5:55 a.m. OK GNU C++11 TESTS 24 62 0 3300
31159655 black_horse2014 G Oct. 9, 2017, 5:41 a.m. OK GNU C++11 TESTS 24 62 0 3300
48175214 ZhongJQ G Jan. 10, 2019, 9:11 a.m. OK GNU C++11 TESTS 24 78 0 3300
65735438 JCC_ G Nov. 26, 2019, 7:32 a.m. OK GNU C++11 TESTS 24 93 0 3300
31212318 Efina G Oct. 11, 2017, 9:30 a.m. OK GNU C++11 TESTS 24 108 102400 3300
60828241 Backseat-Stargazer G Sept. 19, 2019, 5:32 a.m. OK GNU C++11 TESTS 24 109 0 3300
32522954 ANOdo G Nov. 21, 2017, 11:12 a.m. OK GNU C++14 TESTS 24 62 0 3300
31332156 tamkov G Oct. 15, 2017, 7:32 a.m. OK GNU C++14 TESTS 24 62 0 3300
48697264 krijgertje G Jan. 21, 2019, 11:27 p.m. OK GNU C++14 TESTS 24 77 0 3300
38891583 samjia2000 G June 2, 2018, 1:06 p.m. OK GNU C++14 TESTS 24 78 3379200 3300
31179602 apiadu G Oct. 10, 2017, 1:44 a.m. OK GNU C++14 TESTS 24 93 0 3300
48052307 alan_cty G Jan. 7, 2019, 9:57 a.m. OK GNU C++14 TESTS 24 108 204800 3300
48214377 newbiegcz G Jan. 11, 2019, 1:51 p.m. OK GNU C++14 TESTS 24 109 0 3300
31274869 Los_Angelos_Laycurse G Oct. 13, 2017, 12:54 p.m. OK GNU C++14 TESTS 24 109 204800 3300
31274634 Los_Angelos_Laycurse G Oct. 13, 2017, 12:47 p.m. OK GNU C++14 TESTS 24 140 0 3300
31269190 I_Love_Umirzhanova_Amina G Oct. 13, 2017, 8:49 a.m. OK GNU C++14 TESTS 24 140 0 3300
69713623 gongsuidashen G Jan. 29, 2020, 8:07 a.m. OK GNU C++17 TESTS 24 61 0 3300
57426262 Benq G July 20, 2019, 8:35 p.m. OK GNU C++17 TESTS 24 108 0 3300
61962657 manjama G Oct. 6, 2019, 7:56 a.m. OK GNU C++17 TESTS 24 140 0 3300
67191564 mocania G Dec. 19, 2019, 7:17 a.m. OK GNU C++17 TESTS 24 156 0 3300

remove filters

Back to search problems