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"Esports is a form of competitive sports using video games. Dota 2 is one of the most popular competitive video games in Esports. Recently, a new video game Dota 3 was released. In Dota 3 a player can buy some relics for their hero. Relics are counters that track hero's actions and statistics in a game. Gloria likes to play Dota 3, so she wants to buy all n available relics for her favorite hero. Relics can be bought using an in-game currency called shards. Each relic has its own price -- c_i shards for the i -th relic. A player can buy a relic using one of the following options: Gloria wants to buy all n relics. Help her minimize the expected number of shards she spends to buy all the relics. The first line contains two integers n and x ( 1 <= n <= 100 ; 1 <= x <= 10 ,000 ) -- the number of relics and the cost to receive a random relic. The second line consists of n integers c_1, c_2, ldots, c_n ( x <= c_i <= 10 ,000 ; sum{c_i} <= 10 ,000 ) -- the prices of n relics. Print a single real number -- the minimum expected number of shards that Gloria must spend to buy all the relics. The absolute or relative error should not exceed 10^{-9} . In the first example, the optimal strategy is to randomly get one of the two relics paying 20 shards. Then there are two scenarios. The first one happens if Gloria receives the first relic. Then she keeps getting random relics until she obtains the second relic. The expected number of shards to spend in this scenario is 20 + 30 = 50 . In the second scenario, Gloria initially gets the second relic. Then it is better to buy the first relic for 25 shards, so the expected number of shards to spend in this scenario is 20 + 25 = 45 . Thus, the expected number of shards to spend is frac{50 + 45}{2} = 47.5 . "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
66115702 |
I_love_Tanya_Romanova Merkurev |
G |
Dec. 1, 2019, 9:42 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
124 |
12902400 |
|
3100 |
66099464 |
scott_wu stevenkplus |
G |
Dec. 1, 2019, 8:14 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
249 |
13516800 |
|
3100 |
66104086 |
ecnerwala ksun48 |
G |
Dec. 1, 2019, 8:43 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
249 |
16998400 |
|
3100 |
66129117 |
tEMMIE.w. apiadu MiFaFaOvO |
G |
Dec. 1, 2019, 10:41 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
1840 |
32972800 |
|
3100 |
66135283 |
aid |
G |
Dec. 1, 2019, 11:57 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
93 |
12800000 |
|
3100 |
66129308 |
BSBandme |
G |
Dec. 1, 2019, 10:45 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
2105 |
141209600 |
|
3100 |
66133266 |
ko_osaga kcm1700 xiaowuc1 |
G |
Dec. 1, 2019, 11:18 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
2964 |
16998400 |
|
3100 |
remove filters
Back to search problems