QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#797185 | #3247. 挑战 | Milkcat2009 | WA | 1ms | 4192kb | C++14 | 1.4kb | 2024-12-02 18:20:12 | 2024-12-02 18:20:14 |
Judging History
answer
#include <bits/stdc++.h>
#define REP(i, l, r) for (int i = (l); i <= (r); ++ i)
#define DEP(i, r, l) for (int i = (r); i >= (l); -- i)
#define fi first
#define se second
#define pb emplace_back
#define mems(x, v) memset((x), (v), sizeof(x))
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
using namespace std;
namespace Milkcat {
typedef long double LD;
typedef pair<int, int> pii;
const int N = 1e5 + 5, M = 405;
const LD eps = 1E-16;
int n, m, p[M], q[M]; LD f[N][3], ge[M][M * 2], eq[M][M * 2];
void chkmax(LD &x, LD y) { x = max(x, y); }
int main() {
cin >> n, m = 333;
REP(i, 1, n) cin >> p[i];
REP(i, 1, n) cin >> q[i];
REP(i, 1, m) REP(j, 0, m * 2) {
REP(x, 1, i) {
ge[i][j] += min(x, j + 1);
eq[i][j] += (x <= j);
}
ge[i][j] /= i * (j + 1), eq[i][j] /= i * (j + 1);
}
DEP(i, n, 1) REP(j, 1, p[i]) {
if (i + j > n + 1) break;
chkmax(f[i][0], 1 - f[i + j][1]);
chkmax(f[i][1], 1 - f[i + j][1]);
chkmax(f[i][2], f[i + j][1]);
int x = p[i] - j, y = q[i] + q[i + j];
if (x > 0) chkmax(f[i][1], f[i + j][0] * ge[x][y] + (1 - f[i + j][1]) * eq[x][y] + (1 - f[i + j][2]) * (1 - ge[x][y] - eq[x][y]));
}
cout << fixed << setprecision(10) << f[1][1] << '\n';
return 0;
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int T = 1;
while (T --) Milkcat::main();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 4192kb
input:
1000 5 1 33 33 35 2 28 10 2 24 12 19 30 32 3 23 27 3 35 15 13 24 27 13 5 25 3 27 16 18 35 17 11 6 22 1 30 12 11 25 12 17 15 6 17 5 4 25 5 26 2 23 7 18 21 18 31 24 1 15 29 15 16 33 28 23 24 12 13 26 25 28 2 9 27 2 25 16 27 5 20 17 4 4 35 17 17 24 2 27 35 28 3 15 33 33 7 9 6 2 9 34 29 10 27 15 16 32 2...
output:
1.0000000000
result:
wrong answer 1st numbers differ - expected: '0.9251428', found: '1.0000000', error = '0.0748572'