QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#197012 | #3994. Easy Jump | JWRuixi | WA | 0ms | 3932kb | C++20 | 3.6kb | 2023-10-02 07:53:59 | 2023-10-02 07:53:59 |
Judging History
answer
#include <bits/stdc++.h>
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
// #define ATC
#define LL long long
#define eb emplace_back
using namespace std;
#ifdef ATC
#include <atcoder/all>
using namespace atcoder;
#endif
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const int mod = 998244353;
namespace mystd {
typedef pair<int, int> pii;
#define fi first
#define se second
#define MP make_pair
template<typename T, typename _T>
inline void inc (T &x, const _T &y) { x += y; (x >= mod) && (x -= mod); }
template<typename T, typename _T>
inline void dec (T &x, const _T &y) { x -= y; (x < 0) && (x += mod); }
template<typename T, typename _T>
inline void cmax (T &x, const _T &y) { (x < y) && (x = y); }
template<typename T, typename _T>
inline void cmin (T &x, const _T &y) { (x > y) && (x = y); }
template<typename T>
inline void write (const T &Arg) { cout << Arg; }
template<typename T, typename ..._T>
inline void write (const T &Arg, const _T &...Args) { cout << Arg, write(Args...); }
template<typename T>
inline void read (T &Arg) { cin >> Arg; }
template<typename T, typename ..._T>
inline void read (T &Arg, _T &...Args) { cin >> Arg, read(Args...); }
}
using namespace mystd;
const int N = 1005, M = 12;
const double INF = 1e18;
int n, H, S, T1, T2, m;
double f[N][M][M], t[N], p[N];
bool hl[N];
namespace sub1 {
double g[N][M];
inline void slv () {
for (int i = n; i; i--) {
for (int j = 1; j < H; j++) {
if (j == 1) {
g[i][j] = (p[i] * g[i + 1][j] + (1 - p[i]) * T2 + 1) / p[i];
} else {
g[i][j] = (p[i] * g[i + 1][j] + (1 - p[i]) * g[i][j - 1]) + 1;
}
}
}
cout << g[1][H - 1];
exit(0);
}
}
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cout << fixed << setprecision(8);
cin >> n >> H >> S;
for (int i = 1; i <= n; i++) cin >> p[i], p[i] /= 100;
cin >> m;
for (int i = 1, x; i <= m; i++) {
cin >> x;
hl[x] = 1;
}
cin >> T1 >> T2;
if (T1 >= T2) sub1::slv();
for (int i = n; i; i--) {
if (!hl[i]) {
for (int j = 1; j < H; j++) {
for (int k = 0; k <= S; k++) {
if (j == 1) {
if (k > 0) {
f[i][j][k] = (p[i] * f[i + 1][j][k] + (1 - p[i]) * (f[i][j][k - 1] + T1)) + 1;
} else {
f[i][j][k] = (p[i] * f[i + 1][j][k] + (1 - p[i]) * T2 + 1) / p[i];
}
} else {
f[i][j][k] = (p[i] * f[i + 1][j][k] + (1 - p[i]) * f[i][j - 1][k]) + 1;
}
}
}
} else {
for (int j = 1; j < H; j++) {
for (int k = 0; k <= S; k++) {
f[i][j][k] = INF;
}
}
for (int B = 1; B < H; B++) {
t[B] = (p[i] * f[i + 1][B][S] + (1 - p[i]) * T1 + 1) / p[i];
for (int j = B - 1; j; j--)
t[j] = t[j + 1] + T1;
for (int j = B + 1; j < H; j++)
t[j] = (p[i] * f[i + 1][j][S] + (1 - p[i]) * f[i][j - 1][S]) + 1;
for (int j = 1; j < H; j++)
f[i][j][S] = min(f[i][j][S], t[j]);
}
}
}
cout << f[1][H - 1][S];
}
// I love WHQ!
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3932kb
input:
1 2 0 50 0 1 2
output:
4.00000000
result:
ok found '4.0000000', expected '4.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
2 3 1 50 50 1 1 1 3
output:
6.00000000
result:
ok found '6.0000000', expected '6.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
1 6 4 75 0 64 6
output:
1.34114583
result:
ok found '1.3411458', expected '1.3411458', error '0.0000000'
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3740kb
input:
1 5 1 61 1 1 15 43
output:
11.22950820
result:
wrong answer 1st numbers differ - expected: '2.2082232', found: '11.2295082', error = '4.0853139'