Task: | Gambling |
Sender: | JiK |
Submission time: | 2018-10-04 16:37:33 +0300 |
Language: | C++ |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.01 s | details |
#2 | WRONG ANSWER | 0.01 s | details |
#3 | WRONG ANSWER | 0.03 s | details |
#4 | ACCEPTED | 0.02 s | details |
#5 | WRONG ANSWER | 0.03 s | details |
#6 | WRONG ANSWER | 0.02 s | details |
#7 | WRONG ANSWER | 0.02 s | details |
#8 | ACCEPTED | 0.03 s | details |
#9 | ACCEPTED | 0.03 s | details |
#10 | WRONG ANSWER | 0.02 s | details |
#11 | WRONG ANSWER | 0.02 s | details |
#12 | ACCEPTED | 0.02 s | details |
#13 | ACCEPTED | 0.02 s | details |
#14 | WRONG ANSWER | 0.02 s | details |
#15 | WRONG ANSWER | 0.02 s | details |
#16 | ACCEPTED | 0.02 s | details |
#17 | ACCEPTED | 0.03 s | details |
#18 | ACCEPTED | 0.03 s | details |
#19 | WRONG ANSWER | 0.02 s | details |
#20 | WRONG ANSWER | 0.02 s | details |
#21 | WRONG ANSWER | 0.02 s | details |
#22 | WRONG ANSWER | 0.02 s | details |
#23 | ACCEPTED | 0.02 s | details |
#24 | ACCEPTED | 0.03 s | details |
#25 | WRONG ANSWER | 0.03 s | details |
#26 | ACCEPTED | 0.01 s | details |
Code
#include <bits/stdc++.h> using namespace std; typedef bitset<20> bs; typedef int64_t ll; typedef pair<ll,ll> PLL; typedef pair<int, pair<int,int>> PQ; int main() { int n, c, s, p, w; cin >> n >> c >> s >> p >> w; int MAX = n+c+10; vector<double> prob (MAX); prob[c] = 1; double p_lose = (p-1)*1./s; for (int i=0; i<n; i++) { vector<double> pn (MAX); pn[0] = prob[0]; for (int j=1; j<MAX; j++) { //Lose pn[j-1] += p_lose*prob[j]; pn[min(MAX-1, j+w)] += (1-p_lose)*prob[j]; } /* for (int j=0; j<MAX; j++) { std::cout << j << ":" << pn[j] << " "; } cout << endl; */ swap(prob, pn); } double res = 0; for (int j=c+1; j<MAX; j++) { res += prob[j]; } cout << res << endl; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
5 5 13 4 73 |
correct output |
---|
0.9993455303 |
user output |
---|
0.999346 |
Test 2
Verdict: WRONG ANSWER
input |
---|
9 6 37 28 1 |
correct output |
---|
0.06646008751 |
user output |
---|
0.0664601 |
Test 3
Verdict: WRONG ANSWER
input |
---|
1 1 36 36 3 |
correct output |
---|
0.02777777778 |
user output |
---|
0.0277778 |
Test 4
Verdict: ACCEPTED
input |
---|
2 1 64 2 3 |
correct output |
---|
0.984375 |
user output |
---|
0.984375 |
Test 5
Verdict: WRONG ANSWER
input |
---|
6 2 52 26 1 |
correct output |
---|
0.3636643185 |
user output |
---|
0.363664 |
Test 6
Verdict: WRONG ANSWER
input |
---|
22 15 77 25 12 |
correct output |
---|
0.9999999743 |
user output |
---|
1 |
Test 7
Verdict: WRONG ANSWER
input |
---|
803 459 29 22 3 |
correct output |
---|
0.9525856477 |
user output |
---|
0.952586 |
Test 8
Verdict: ACCEPTED
input |
---|
530 229 76 76 3 |
correct output |
---|
7.263693949e-125 |
user output |
---|
7.26369e-125 |
Test 9
Verdict: ACCEPTED
input |
---|
992 301 37 2 7 |
correct output |
---|
1 |
user output |
---|
1 |
Test 10
Verdict: WRONG ANSWER
input |
---|
51 30 66 33 3 |
correct output |
---|
0.9999582768 |
user output |
---|
0.999958 |
Test 11
Verdict: WRONG ANSWER
input |
---|
354 9 14 4 17 |
correct output |
---|
0.9999990473 |
user output |
---|
0.999999 |
Test 12
Verdict: ACCEPTED
input |
---|
605 163 62 47 2 |
correct output |
---|
2.001220685e-05 |
user output |
---|
2.00122e-05 |
Test 13
Verdict: ACCEPTED
input |
---|
752 726 100 100 2 |
correct output |
---|
1.950508782e-298 |
user output |
---|
1.95051e-298 |
Test 14
Verdict: WRONG ANSWER
input |
---|
17 4 43 2 1 |
correct output |
---|
0.9999996786 |
user output |
---|
1 |
Test 15
Verdict: WRONG ANSWER
input |
---|
614 526 87 44 1 |
correct output |
---|
0.5966130552 |
user output |
---|
0.596613 |
Test 16
Verdict: ACCEPTED
input |
---|
1000 177 62 20 5 |
correct output |
---|
1 |
user output |
---|
1 |
Test 17
Verdict: ACCEPTED
input |
---|
1000 126 97 73 2 |
correct output |
---|
4.851018941e-08 |
user output |
---|
4.85102e-08 |
Test 18
Verdict: ACCEPTED
input |
---|
1000 366 5 5 3 |
correct output |
---|
5.070453651e-05 |
user output |
---|
5.07045e-05 |
Test 19
Verdict: WRONG ANSWER
input |
---|
1000 1 66 2 2 |
correct output |
---|
0.9848450569 |
user output |
---|
0.984845 |
Test 20
Verdict: WRONG ANSWER
input |
---|
1000 117 65 33 1 |
correct output |
---|
0.6754575722 |
user output |
---|
0.675458 |
Test 21
Verdict: WRONG ANSWER
input |
---|
1000 15 76 25 63 |
correct output |
---|
0.999999969 |
user output |
---|
1 |
Test 22
Verdict: WRONG ANSWER
input |
---|
1000 108 60 45 3 |
correct output |
---|
0.8765579698 |
user output |
---|
0.876558 |
Test 23
Verdict: ACCEPTED
input |
---|
1000 836 93 93 1 |
correct output |
---|
0 |
user output |
---|
0 |
Test 24
Verdict: ACCEPTED
input |
---|
1000 262 70 2 2 |
correct output |
---|
1 |
user output |
---|
1 |
Test 25
Verdict: WRONG ANSWER
input |
---|
1000 267 44 22 1 |
correct output |
---|
0.9202679431 |
user output |
---|
0.920268 |
Test 26
Verdict: ACCEPTED
input |
---|
20 45 10 1 1 |
correct output |
---|
1 |
user output |
---|
1 |