QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#635023 | #3994. Easy Jump | dspt | WA | 0ms | 1672kb | C++23 | 1.7kb | 2024-10-12 18:45:32 | 2024-10-12 18:45:33 |
Judging History
answer
#include <stdio.h>
int b[1001]; double p[1001], f[1001][10][7], g[1001][10];
int main()
{
int n, h, s, t1, t2; scanf("%d%d%d", &n, &h, &s);
for (int i(1); i <= n; ++i) scanf("%lf", &p[i]), p[i] /= 100;
for (int i(1); i <= n; ++i) scanf("%d", &b[i]);
scanf("%d%d", &t1, &t2);
if (t1 >= t2 || !s)
{
for (int i(n); i; --i)
{
g[i][2] = (t2 + 1) / p[i] + g[i + 1][2] - t2;
for (int j(3); j <= h; ++j) g[i][j] = p[i] * g[i + 1][j] + (1 - p[i]) * g[i][j - 1] + 1;
}
printf("%.6f\n", g[1][h]);
}
else
{
for (int i(n); i; --i)
if (b[i])
{
int d[h + 1]; for (int j(0); j <= h; ++j) d[j] = 1e9;
for (int c(2), e[h + 1]; c <= h; ++c)
{
e[c] = (t1 + 1) / p[i] + f[i + 1][c][s] - t1;
for (int j(c + 1); j <= h; ++j) e[j] = p[i] * f[i + 1][j][s] + (1 - p[i]) * e[j - 1] + 1;
for (int j(2); j <= c; ++j) if (e[c] + (c - j) * t1 < d[j]) d[j] = e[c] + (c - j) * t1;
}
for (int j(2); j <= h; ++j) for (int k(0); k <= s; ++k) f[i][j][k] = d[j];
}
else
{
f[i][2][0] = (t2 + 1) / p[i] + f[i + 1][2][0] - t2;
for (int k(0); k <= s; ++k) f[i][2][k] = p[i] * f[i + 1][2][k] + (1 - p[i]) * (f[i][2][k - 1] + t1) + 1;
for (int j(2); j <= h; ++j) for (int k(0); k <= s; ++k)
f[i][j][k] = p[i] * f[i + 1][j][k] + (1 - p[i]) * f[i][j - 1][k];
}
printf("%.6f\n", f[1][h][s]);
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 1620kb
input:
1 2 0 50 0 1 2
output:
4.000000
result:
ok found '4.0000000', expected '4.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 1604kb
input:
2 3 1 50 50 1 1 1 3
output:
6.000000
result:
ok found '6.0000000', expected '6.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 1672kb
input:
1 6 4 75 0 64 6
output:
1.341146
result:
ok found '1.3411460', expected '1.3411458', error '0.0000001'
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 1612kb
input:
1 5 1 61 1 1 15 43
output:
2.000000
result:
wrong answer 1st numbers differ - expected: '2.2082232', found: '2.0000000', error = '0.0942945'