QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#828347 | #8774. Manhattan Walk | suo | TL | 16ms | 10744kb | Python3 | 540b | 2024-12-23 16:06:07 | 2024-12-23 16:06:07 |
Judging History
answer
r, c, p = map(int, input().split())
dp = [[0] * c for i in range(r)]
for i in range(r - 1, -1, -1):
for j in range(c - 1, -1, -1):
if i == r - 1 and j == c - 1:
continue
di = (1 << 30) if i == r - 1 else dp[i + 1][j]
dj = (1 << 30) if j == c - 1 else dp[i][j + 1]
t = min(p, max(0, dj - di))
ans = t * t / 2 + t * di + (p - t) * dj
t = min(p, max(0, di - dj))
ans += t * t / 2 + t * dj + (p - t) * di
dp[i][j] = ans / (2 * p)
print(dp[0][0])
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 16ms
memory: 10744kb
input:
2 3 8
output:
2.875
result:
ok found '2.8750000', expected '2.8750000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 5ms
memory: 10696kb
input:
5 5 5
output:
2.4322338688738814
result:
ok found '2.4322339', expected '2.4322339', error '0.0000000'
Test #3:
score: 0
Accepted
time: 8ms
memory: 10524kb
input:
1 1 1
output:
0
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #4:
score: -100
Time Limit Exceeded
input:
1000 1000 1000000000