QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#637037 | #8774. Manhattan Walk | Tenshi# | Compile Error | / | / | C++23 | 1.3kb | 2024-10-13 06:36:21 | 2024-10-13 06:36:21 |
Judging History
answer
// #include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ld long double
int main() {
long long r, c; cin >> r >> c;
ld p; cin >> p;
ld ans[r][c];
ld p4 = p*(ld)4;
rep (ii, r) {
rep (jj, c) {
int i = r-ii-1;
int j = c-jj-1;
// cout << i << ' ' << j << endl;
if (i==r-1 and j==c-1) {
ans[i][j] = 0;
}
else if (i==r-1) {
ans[i][j] = ans[i][j+1] + p/(ld)4;
}
else if (j==c-1) {
ans[i][j] = ans[i+1][j] + p/(ld)4;
}
else {
ld mn = ans[i+1][j];
ld mx = ans[i+1][j];
if (ans[i+1][j] < ans[i][j+1]) {
mx = ans[i][j+1];
}
else {
mn = ans[i][j+1];
}
ld d = mx-mn;
ans[i][j] = mn/2.0 + mx/2.0 - (mn/p4)*d;
}
assert(ans[i][j] > -0.5);
}
}
rep(i, r) {
rep(j, c) {
cout << ans[i][j] << ' ';
}
cout << endl << endl;
}
cout << fixed << setprecision(10) << ans[0][0] << endl;
}
Details
answer.code: In function ‘int main()’: answer.code:42:13: error: ‘assert’ was not declared in this scope 42 | assert(ans[i][j] > -0.5); | ^~~~~~ answer.code:4:1: note: ‘assert’ is defined in header ‘<cassert>’; did you forget to ‘#include <cassert>’? 3 | #include <iomanip> +++ |+#include <cassert> 4 |