QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#293873 | #3994. Easy Jump | rageOfThunder | WA | 18ms | 5668kb | C++14 | 3.1kb | 2023-12-29 21:27:08 | 2023-12-29 21:27:08 |
Judging History
answer
// MagicDark
#include <bits/stdc++.h>
#define debug cerr << "[" << __LINE__ << "] "
#define SZ(x) (int) x.size() - 1
#define all(x) x.begin(), x.end()
#define ms(x, y) memset(x, y, sizeof x)
#define F(i, x, y) for (int i = (x); i <= (y); i++)
#define DF(i, x, y) for (int i = (x); i >= (y); i--)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template <typename T> inline void chkmax(T& x, T y) {x = max(x, y);}
template <typename T> inline void chkmin(T& x, T y) {x = min(x, y);}
template <typename T> inline void read(T &x) {
x = 0; int f = 1; char c = getchar();
for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
x *= f;
}
int n, h, s;
double p[1010], f[1010][15][15], g[15];
int t1, t2;
bool t[1010];
double merge(double x, double y) {
return (x < 0) ? y : (y < 0 ? x : min(x, y));
}
signed main() {
cin.tie(0) -> sync_with_stdio(0); // don't use puts
cin >> n >> h >> s;
F(i, 1, n) {
cin >> p[i];
p[i] /= 100;
}
{
int t; cin >> t;
while (t--) {
int x; cin >> x;
::t[x] = true;
}
}
cin >> t1 >> t2;
DF(i, n, 1) {
if (t[i]) {
F(a, 1, h) g[a] = -1;
if (s) {
F(_, 1, 1000) {
F(a, 1, h) {
if (a > 1) {// 操作 1
double A = f[i + 1][a][s];
if (A >= 0) {
A = (p[i] * A + (1 - p[i]) * t2 + 1) / p[i];
double B = -1;
if (g[a - 1] >= 0) B = 1 + p[i] * f[i + 1][a][s] + (1 - p[i]) * g[a - 1];
g[a] = merge(g[a], merge(A, B));
}
}
}
DF(a, h - 1, 1)
if (g[a + 1] >= 0) g[a] = merge(g[a], g[a + 1] + t1);
}
} else {
F(a, 1, h) {
if (a > 1) {// 操作 1
double A = f[i + 1][a][s];
if (A >= 0) {
A = (p[i] * A + (1 - p[i]) * t2 + 1) / p[i];
double B = -1;
if (g[a - 1] >= 0) B = 1 + p[i] * f[i + 1][a][s] + (1 - p[i]) * g[a - 1];
g[a] = merge(g[a], merge(A, B));
}
}
}
}
F(j, 1, h + s)
DF(a, h, 1) {
int b = j - a;
if (b < 0 || b > s) continue;
f[i][a][b] = g[a];
}
// F(a, 1, h) cout << g[a] << " "; cout << endl;
} else {
F(j, 1, h + s)
DF(a, h, 1) {
int b = j - a;
if (b < 0 || b > s) continue;
f[i][a][b] = -1;
if (a > 1) {// 操作 1
if (f[i + 1][a][b] >= 0) {
double A = (p[i] * f[i + 1][a][b] + (1 - p[i]) * t2 + 1) / p[i];
double B = -1;
if (f[i][a - 1][b] >= 0) B = 1 + p[i] * f[i + 1][a][b] + (1 - p[i]) * f[i][a - 1][b], assert(B >= 0);
assert(A >= 0);
f[i][a][b] = merge(f[i][a][b], merge(A, B));
}
}
// 操作 2
if (a < h && b && f[i][a + 1][b - 1] >= 0) f[i][a][b] = merge(f[i][a][b], f[i][a + 1][b - 1] + t1);//, debug << f[i][a + 1][b - 1] << endl;
}
}
// debug << i << endl;
// F(a, 1, h)
// F(b, 0, s) {
// if (f[i][a][b] < 0) assert(f[i][a][b] == -1);
// cout << f[i][a][b] << " \n"[b == s];
// }
// cout << endl;
}
cout << fixed << setprecision(10) << f[1][h][s];
return 0;
}
/* why?
*/
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3680kb
input:
1 2 0 50 0 1 2
output:
4.0000000000
result:
ok found '4.0000000', expected '4.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
2 3 1 50 50 1 1 1 3
output:
6.0000000000
result:
ok found '6.0000000', expected '6.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
1 6 4 75 0 64 6
output:
1.3411458333
result:
ok found '1.3411458', expected '1.3411458', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
1 5 1 61 1 1 15 43
output:
2.2082231967
result:
ok found '2.2082232', expected '2.2082232', error '0.0000000'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3900kb
input:
10 9 3 12 65 76 33 17 20 89 16 4 63 3 2 4 8 73 21
output:
942.4148420128
result:
ok found '942.4148420', expected '942.4148420', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3932kb
input:
10 6 0 26 6 29 76 92 46 8 4 91 44 1 4 17 6
output:
401.8668629820
result:
ok found '401.8668630', expected '401.8668630', error '0.0000000'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3996kb
input:
100 3 5 85 59 20 75 58 42 79 95 22 15 95 81 69 73 45 42 99 93 58 8 18 34 88 14 23 37 87 16 96 17 40 58 32 26 93 9 37 15 68 49 99 73 48 79 16 27 52 4 66 53 48 55 27 56 52 66 25 30 34 11 97 20 38 30 4 78 17 98 4 23 30 71 87 94 89 71 45 92 72 24 90 24 78 48 62 82 30 30 27 55 64 66 41 72 53 97 59 38 80 ...
output:
13395.8550625145
result:
ok found '13395.8550625', expected '13395.8550625', error '0.0000000'
Test #8:
score: 0
Accepted
time: 2ms
memory: 4032kb
input:
100 6 5 71 18 59 37 83 16 53 4 42 38 52 89 95 42 39 17 27 84 53 45 36 50 7 63 23 69 34 74 68 13 65 81 48 77 36 87 57 22 47 70 50 54 16 63 32 96 70 30 25 97 35 33 59 76 40 54 68 60 19 34 73 8 71 77 97 39 27 37 93 19 71 94 61 33 28 80 86 79 16 2 42 89 19 43 97 52 95 69 53 67 37 51 4 53 7 36 82 67 80 2...
output:
15012.9833031761
result:
ok found '15012.9833032', expected '15012.9833032', error '0.0000000'
Test #9:
score: 0
Accepted
time: 0ms
memory: 4072kb
input:
100 4 1 15 95 82 67 93 57 92 60 48 53 26 94 10 24 88 48 48 28 9 62 55 6 8 39 25 87 14 10 50 19 24 89 11 98 3 30 16 22 43 80 26 49 47 59 38 70 79 94 2 72 78 28 83 34 30 52 45 83 9 42 63 46 83 95 49 21 38 48 87 65 45 7 91 9 5 32 57 21 39 34 71 69 87 44 12 38 72 99 55 23 21 42 87 91 85 93 47 28 25 96 8...
output:
22457.8011509807
result:
ok found '22457.8011510', expected '22457.8011510', error '0.0000000'
Test #10:
score: 0
Accepted
time: 1ms
memory: 4032kb
input:
100 6 4 52 32 81 87 70 91 23 65 91 47 84 60 76 18 31 34 17 85 31 68 80 35 60 86 63 42 76 94 90 25 76 1 38 87 68 19 43 66 7 12 82 7 58 93 66 3 92 92 64 82 10 91 55 27 41 45 44 59 91 30 86 69 77 36 76 49 46 91 14 14 58 51 4 91 23 56 72 86 65 78 91 21 80 77 75 13 36 99 34 61 56 79 5 32 49 37 26 93 70 5...
output:
4276.8043968671
result:
ok found '4276.8043969', expected '4276.8043969', error '0.0000000'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3848kb
input:
100 3 5 18 54 94 38 94 89 65 11 6 7 20 36 99 17 55 98 14 74 78 32 95 67 20 21 24 67 50 96 72 42 22 32 14 82 44 81 37 94 11 22 86 33 41 36 9 41 90 66 27 13 7 93 89 84 1 4 1 75 33 92 55 11 19 71 40 45 40 9 32 81 98 58 70 23 30 49 24 98 15 41 35 51 3 6 83 54 14 28 81 64 71 86 33 45 51 61 14 18 19 12 10...
output:
31638.9764386716
result:
ok found '31638.9764387', expected '31638.9764387', error '0.0000000'
Test #12:
score: 0
Accepted
time: 15ms
memory: 5600kb
input:
1000 8 3 67 7 89 71 35 18 39 60 12 76 58 9 78 97 89 71 55 25 3 12 36 52 55 20 51 25 25 1 30 49 23 63 54 52 17 81 89 64 47 92 20 98 96 12 53 21 85 75 55 5 25 20 63 43 28 65 11 97 42 64 23 91 40 87 61 98 36 48 24 40 6 20 17 7 28 75 89 52 22 78 96 97 62 85 54 73 10 37 93 49 14 72 27 71 91 77 38 84 70 3...
output:
262807.7847388362
result:
ok found '262807.7847388', expected '262807.7847388', error '0.0000000'
Test #13:
score: 0
Accepted
time: 1ms
memory: 5592kb
input:
1000 6 3 73 3 44 64 34 50 44 97 16 2 63 94 50 41 12 70 14 12 86 83 73 36 92 47 66 54 68 52 17 92 38 5 22 47 96 67 3 21 9 35 45 77 51 80 54 12 13 95 59 41 53 49 77 23 40 19 60 74 99 93 51 51 2 22 6 46 34 29 28 68 92 20 37 93 88 69 7 30 62 79 55 30 56 36 62 89 70 47 28 78 28 15 59 43 63 59 29 67 45 86...
output:
452525.4353648754
result:
ok found '452525.4353649', expected '452525.4353649', error '0.0000000'
Test #14:
score: 0
Accepted
time: 0ms
memory: 5576kb
input:
1000 6 3 25 71 28 1 12 61 61 64 75 77 24 70 48 17 93 15 78 58 37 83 37 89 26 83 18 53 57 6 83 14 83 95 63 19 44 87 75 52 68 99 77 22 41 77 91 46 52 55 30 83 8 46 46 95 41 83 12 84 56 68 52 88 32 15 66 89 9 4 24 71 45 79 27 79 81 73 77 83 1 12 14 86 15 17 18 51 76 54 51 50 86 22 46 97 27 7 15 68 8 3 ...
output:
305463.1947235368
result:
ok found '305463.1947235', expected '305463.1947235', error '0.0000000'
Test #15:
score: 0
Accepted
time: 1ms
memory: 5668kb
input:
1000 6 0 9 73 54 66 24 28 96 71 75 93 67 82 2 69 25 88 22 25 62 26 91 21 28 73 91 11 36 89 40 53 6 39 20 84 52 30 19 10 29 40 16 40 33 87 41 93 51 2 83 44 86 96 55 68 2 62 43 52 90 89 54 93 72 8 25 55 29 24 24 31 29 12 55 3 35 71 77 14 11 47 3 58 66 25 48 44 98 28 24 46 39 74 68 88 69 68 99 23 66 15...
output:
198576.7034534805
result:
ok found '198576.7034535', expected '198576.7034535', error '0.0000000'
Test #16:
score: 0
Accepted
time: 3ms
memory: 5592kb
input:
1000 5 3 77 43 54 22 15 44 57 52 99 53 3 8 56 29 95 99 33 34 8 69 6 44 41 74 51 88 77 39 66 45 2 52 37 1 91 90 68 64 64 71 69 14 42 20 41 60 67 53 96 64 42 30 27 23 44 73 64 59 66 41 47 4 11 36 67 43 22 18 37 48 61 88 44 59 77 70 52 65 78 5 45 40 22 94 19 12 45 2 66 37 45 95 67 94 38 55 11 63 77 72 ...
output:
124894.6310147135
result:
ok found '124894.6310147', expected '124894.6310147', error '0.0000000'
Test #17:
score: 0
Accepted
time: 1ms
memory: 5444kb
input:
1000 5 0 18 21 52 20 8 18 14 27 59 45 11 96 94 57 16 19 40 43 83 13 33 29 72 5 64 53 49 79 88 6 66 83 28 39 47 57 84 62 88 77 48 76 27 31 36 42 3 47 33 55 71 66 96 60 2 13 47 33 44 36 50 50 81 37 98 53 13 9 40 12 97 83 65 64 25 68 15 48 31 68 89 72 40 80 13 57 80 73 54 96 56 55 73 44 44 64 86 7 7 6 ...
output:
316712.1332163124
result:
ok found '316712.1332163', expected '316712.1332163', error '0.0000000'
Test #18:
score: 0
Accepted
time: 6ms
memory: 5544kb
input:
1000 7 3 4 82 64 83 71 66 78 27 3 11 95 6 56 74 18 14 91 6 31 78 61 69 44 13 98 47 12 54 11 2 29 56 17 18 73 11 58 9 58 29 3 60 8 12 99 97 24 77 85 95 14 22 31 2 86 25 3 67 61 46 40 80 17 57 90 28 29 79 81 16 52 4 15 2 18 88 36 38 82 75 11 31 6 95 84 99 35 56 21 63 85 82 9 16 30 33 46 42 52 57 72 45...
output:
187286.4175019997
result:
ok found '187286.4175020', expected '187286.4175020', error '0.0000000'
Test #19:
score: 0
Accepted
time: 8ms
memory: 5536kb
input:
1000 5 6 42 60 83 6 82 4 22 82 9 19 69 7 66 56 67 49 5 49 79 3 76 22 45 81 5 73 91 81 88 96 99 64 74 35 36 53 9 12 49 39 82 51 43 8 6 83 33 39 66 65 61 21 51 60 84 19 76 86 43 58 26 15 30 78 42 10 32 86 79 73 19 16 45 73 87 45 3 79 10 8 32 7 74 92 97 88 20 78 39 23 69 77 92 58 5 90 3 7 99 38 61 45 8...
output:
191657.0161835172
result:
ok found '191657.0161835', expected '191657.0056147', error '0.0000001'
Test #20:
score: 0
Accepted
time: 18ms
memory: 5604kb
input:
1000 8 6 32 27 28 71 8 77 5 94 21 42 29 15 88 21 61 25 32 39 74 41 94 34 63 38 5 6 38 44 60 1 17 83 98 90 77 40 33 16 25 59 37 36 98 95 23 45 59 68 21 11 48 3 91 83 68 11 24 29 31 81 97 3 63 18 36 66 50 25 65 57 63 43 19 12 34 50 40 66 57 85 87 72 15 86 33 51 73 22 53 27 38 61 56 35 58 25 26 23 92 5...
output:
334990.8675322531
result:
ok found '334990.8675323', expected '334990.8665802', error '0.0000000'
Test #21:
score: 0
Accepted
time: 1ms
memory: 5344kb
input:
950 2 6 44 25 3 27 5 97 18 49 31 54 89 53 32 27 87 98 95 56 49 35 80 94 91 16 96 25 46 60 36 27 38 40 62 18 3 68 51 45 53 87 4 18 45 26 66 73 38 37 45 92 10 39 33 72 68 18 98 10 26 80 97 2 66 56 6 67 10 70 73 43 1 8 7 31 34 2 26 26 75 22 32 13 59 30 66 67 4 33 16 97 85 16 12 37 24 54 19 11 35 70 83 ...
output:
156875.0622893387
result:
ok found '156875.0622893', expected '156875.0622893', error '0.0000000'
Test #22:
score: 0
Accepted
time: 2ms
memory: 5620kb
input:
1000 6 5 96 33 90 86 69 10 50 29 48 38 47 24 8 29 53 98 94 29 57 38 59 13 61 10 94 2 67 79 96 12 7 48 40 41 66 81 85 39 86 19 59 51 46 73 74 29 80 83 41 64 72 6 14 7 96 53 32 25 82 39 54 20 19 23 90 64 67 70 28 20 19 97 84 36 41 71 44 3 30 93 84 58 35 80 42 25 75 3 89 15 11 68 98 66 41 82 24 24 26 9...
output:
165921.1861608788
result:
ok found '165921.1861609', expected '165921.1861609', error '0.0000000'
Test #23:
score: 0
Accepted
time: 2ms
memory: 5596kb
input:
999 4 6 65 60 6 32 43 73 62 90 23 99 80 90 83 31 27 60 43 65 86 19 50 38 87 47 41 87 88 21 16 4 25 94 91 74 37 23 96 99 83 87 82 29 36 70 76 55 52 2 86 79 36 86 72 61 61 47 77 75 70 54 22 2 80 96 75 95 15 12 5 75 70 78 12 86 13 64 99 83 38 92 88 27 30 43 44 12 52 83 20 70 18 99 25 31 46 32 83 25 77 ...
output:
33450.9150264715
result:
ok found '33450.9150265', expected '33450.9150265', error '0.0000000'
Test #24:
score: 0
Accepted
time: 1ms
memory: 5640kb
input:
990 3 2 12 27 24 8 62 86 67 17 23 15 25 92 28 85 27 43 67 82 18 26 78 30 24 79 34 49 59 23 69 33 2 64 30 90 33 12 5 2 64 29 7 75 50 97 43 57 24 59 14 14 40 30 22 66 42 59 97 69 62 26 77 36 80 91 81 47 5 7 84 5 41 60 25 68 86 41 66 95 1 55 65 75 96 73 65 21 33 22 9 61 78 36 73 88 95 49 13 4 40 61 50 ...
output:
384908.1747775631
result:
ok found '384908.1747776', expected '384908.1747776', error '0.0000000'
Test #25:
score: 0
Accepted
time: 0ms
memory: 4880kb
input:
550 3 0 21 55 47 13 16 92 54 15 75 95 81 26 19 60 33 86 12 69 87 52 99 65 74 46 78 22 59 38 62 62 90 47 14 19 80 18 56 63 56 43 1 14 42 13 88 29 50 76 36 96 69 39 90 18 38 22 43 8 93 1 25 20 92 51 73 67 61 75 80 66 9 30 81 98 76 58 10 70 55 34 22 9 87 84 86 60 87 90 99 84 16 17 41 29 99 36 73 62 93 ...
output:
128698.5949629348
result:
ok found '128698.5949629', expected '128698.5949629', error '0.0000000'
Test #26:
score: 0
Accepted
time: 0ms
memory: 5528kb
input:
1000 6 3 73 3 44 64 34 50 44 97 16 2 63 94 50 41 12 70 14 12 86 83 73 36 92 47 66 54 68 52 17 92 38 5 22 47 96 67 3 21 9 35 45 77 51 80 54 12 13 95 59 41 53 49 77 23 40 19 60 74 99 93 51 51 2 22 6 46 34 29 28 68 92 20 37 93 88 69 7 30 62 79 55 30 56 36 62 89 70 47 28 78 28 15 59 43 63 59 29 67 45 86...
output:
377298.8628040620
result:
ok found '377298.8628041', expected '377298.8628041', error '0.0000000'
Test #27:
score: 0
Accepted
time: 2ms
memory: 5592kb
input:
1000 6 3 25 71 28 1 12 61 61 64 75 77 24 70 48 17 93 15 78 58 37 83 37 89 26 83 18 53 57 6 83 14 83 95 63 19 44 87 75 52 68 99 77 22 41 77 91 46 52 55 30 83 8 46 46 95 41 83 12 84 56 68 52 88 32 15 66 89 9 4 24 71 45 79 27 79 81 73 77 83 1 12 14 86 15 17 18 51 76 54 51 50 86 22 46 97 27 7 15 68 8 3 ...
output:
396515.8152199471
result:
ok found '396515.8152199', expected '396515.8152199', error '0.0000000'
Test #28:
score: 0
Accepted
time: 0ms
memory: 5600kb
input:
1000 2 0 29 25 70 52 25 81 1 9 2 60 84 13 65 12 45 36 42 77 47 82 17 99 50 51 49 7 45 69 52 51 60 60 95 27 54 38 35 60 52 85 49 4 73 8 51 43 76 11 78 39 85 25 47 84 42 71 42 78 52 56 29 49 28 69 18 13 25 29 30 90 36 8 74 31 51 23 15 11 93 46 79 19 89 91 41 88 30 24 76 93 29 81 51 33 17 12 72 24 26 5...
output:
313346.0739782110
result:
ok found '313346.0739782', expected '313346.0739782', error '0.0000000'
Test #29:
score: -100
Wrong Answer
time: 0ms
memory: 5656kb
input:
1000 2 3 93 41 4 36 96 41 61 43 19 34 51 11 79 39 13 85 18 92 27 20 87 77 58 61 3 91 66 17 78 98 58 67 41 61 7 96 74 12 37 49 62 42 63 8 13 66 42 8 48 40 5 12 67 22 78 13 46 6 41 74 16 56 50 1 92 91 39 6 72 16 97 28 76 40 60 97 77 25 30 45 62 85 42 89 20 70 1 5 48 74 57 67 72 96 79 60 68 62 52 23 49...
output:
223191.7169338567
result:
wrong answer 1st numbers differ - expected: '223189.9555069', found: '223191.7169339', error = '0.0000079'