QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#47180 | #1857. PlayerUnknown's Battlegrounds | YaoBIG# | WA | 6ms | 3760kb | C++ | 1.3kb | 2022-09-04 15:27:05 | 2022-09-04 15:27:07 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 300;
int arr[N][N];
pair<int, int> rev[N];
int rdist[N][2];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int h, w;
cin >> h >> w;
for (int y = 0; y < h; ++y) {
for (int x = 0; x < w; ++x) {
cin >> arr[y][x];
--arr[y][x];
rev[arr[y][x]] = {y, x};
}
}
for (int v = 0; v < h*w; ++v) {
int ty = rev[v].first;
int tx = rev[v].second;
for (int x = 0; x < w; ++x) {
for (int j = 0; j <= 1; ++j) {
int dir = (j == 0 ? 1 : -1);
for (rdist[x][j] = 0;; ++rdist[x][j]) {
int y = (ty + rdist[x][j] * dir);
if (y < 0 || y >= h || arr[y][x] < v) break;
}
}
}
ll res = 0;
int le_d0 = h, le_d1 = h;
for (int x0 = tx; x0 >= 0; --x0) {
le_d0 = min(le_d0, rdist[x0][0]);
le_d1 = min(le_d1, rdist[x0][1]);
int ri_d0 = h, ri_d1 = h;
for (int x1 = tx; x1 < w; ++x1) {
ri_d0 = min(ri_d0, rdist[x1][0]);
ri_d1 = min(ri_d1, rdist[x1][1]);
ll add = (ll)min(le_d0, ri_d0) * min(le_d1, ri_d1);
res += add;
// cerr << v << ' ' << x0 << ' ' << x1 << ": " << add << ' ' << le_d0 << ' ' << ri_d0 << ' ' << le_d1 << ' ' << ri_d1 << '\n';
}
}
cout << res << '\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3608kb
input:
2 3 2 5 1 6 3 4
output:
6 4 5 1 1 1
result:
ok 6 lines
Test #2:
score: -100
Wrong Answer
time: 6ms
memory: 3760kb
input:
50 50 274 1151 2130 502 862 1007 692 1789 1912 37 59 805 2056 891 1341 673 2436 1647 1925 1226 2209 2134 511 1308 1881 1692 1885 216 2321 1032 1106 334 893 720 2269 45 1069 2031 1891 370 40 1916 1790 1671 269 1343 349 509 137 9 2386 1275 834 1519 1896 1729 66 2049 872 262 2240 1813 943 968 475 2051 ...
output:
126360 34120 1767 152106 35335 35468 53600 103026 6 18274 7626 29608 15 34632 14350 4 5502 92 2466 13508 0 23403 0 0 2606 9337 4061 2106 9 0 5 74 24919 0 15511 2974 0 1178 2455 0 8118 2734 0 0 0 0 0 5018 2682 8364 6556 6150 1960 15142 11594 12777 3015 4 0 0 3257 6985 6742 1368 0 0 1615 0 444 810 0 1...
result:
wrong answer 2nd lines differ - expected: '37360', found: '34120'