QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#427580#8768. Arrested Developmentucup-team055#WA 0ms3936kbC++231015b2024-06-01 13:59:212024-06-01 13:59:22

Judging History

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

  • [2024-06-01 13:59:22]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3936kb
  • [2024-06-01 13:59:21]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
const ll INF = LLONG_MAX / 4;
#define rep(i, a, b) for(ll i = a; i < (b); i++)
#define all(a) begin(a), end(a)
#define sz(a) ssize(a)
bool chmin(auto& a, auto b) { if(a <= b) return 0; a = b; return 1; }
bool chmax(auto& a, auto b) { if(a >= b) return 0; a = b; return 1; }

int main() {
    cin.tie(0)->sync_with_stdio(0);
    ll h, w;
    double p;
    cin >> h >> w >> p;
    vector dp(h, vector<double>(w, INFINITY));
    dp[0][0] = 0;
    rep(i, 0, h) rep(j, 0, w) {
        double& ans = dp[i][j];
        double L = i ? dp[i - 1][j] : INFINITY;
        double R = j ? dp[i][j - 1] : INFINITY;
        if(L > R) swap(L, R);
        chmin(ans, L + p / 4);
        if(i && j) {
            const double wait = min(p, R - L);
            chmin(ans, ((p + wait) * L + wait * wait / 2 + (p - wait) * R) / 2 / p);
        }
    }
    cout.precision(10);
    cout << dp.back().back() << endl;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3936kb

input:

4
100 1
1 90
1 20
1 20

output:

22.67747012

result:

wrong answer 1st lines differ - expected: '3', found: '22.67747012'