QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#427580 | #8768. Arrested Development | ucup-team055# | WA | 0ms | 3936kb | C++23 | 1015b | 2024-06-01 13:59:21 | 2024-06-01 13:59:22 |
Judging History
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'