QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#828355 | #8774. Manhattan Walk | suo | WA | 0ms | 3920kb | C++20 | 824b | 2024-12-23 16:10:24 | 2024-12-23 16:10:29 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
int r, c;
long double p;
cin >> r >> c >> p;
long double dp[r][c];
dp[r - 1][c - 1] = 0;
for (int i = r - 1; i >= 0; i--) {
for (int j = c - 1; j >= 0; j--) {
if (i == r - 1 && j == c - 1) continue;
long double di = (i == r - 1) ? (1 << 40) : dp[i + 1][j];
long double dj = (j == c - 1) ? (1 << 40) : dp[i][j + 1];
long double t = min(p, max((long double)0, dj - di));
long double ans = t * t / 2 + t * di + (p - t) * dj;
t = min(p, max((long double)0, di - dj));
ans += t * t / 2 + t * dj + (p - t) * di;
dp[i][j] = ans / 2 / p;
}
}
cout << setprecision(11);
cout << dp[0][0] << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3920kb
input:
2 3 8
output:
0
result:
wrong answer 1st numbers differ - expected: '2.8750000', found: '0.0000000', error = '1.0000000'