QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#454717#8774. Manhattan Walkucup-team173WA 0ms4036kbC++20933b2024-06-25 10:59:202024-06-25 10:59:21

Judging History

你现在查看的是最新测评结果

  • [2024-06-25 10:59:21]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4036kb
  • [2024-06-25 10:59:20]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

using i64 = long long;

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int r, c, p;
    cin >> r >> c >> p;
    vector<vector<double>> f(r, vector<double>(c));
    for(int i = r - 1; i >= 0; i--) {
        for(int j = c - 1; j >= 0; j--) {
            double a = -1, b = -1;
            if(i + 1 < r) {
                a = f[i + 1][j];
            }
            if(j + 1 < c) {
                b = f[i][j + 1];
            }
            if(a > b) swap(a, b);
            if(b == -1) continue;
            if(a == -1) {
                f[i][j] = b + p / 4.;
            } else if(b >= a + p) {
                f[i][j] = a + p / 4.;
            } else {
                f[i][j] = (p - (b - a)) / 2. / p * b + a / 2. + (b - a) / 2. / p * (a + b) / 2;
            }
        }
    }
    cout << f[0][0] << '\n';
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 4036kb

input:

2 3 8

output:

2.875

result:

ok found '2.8750000', expected '2.8750000', error '0.0000000'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3904kb

input:

5 5 5

output:

2.43223

result:

wrong answer 1st numbers differ - expected: '2.4322339', found: '2.4322300', error = '0.0000016'