QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#47181 | #1857. PlayerUnknown's Battlegrounds | YaoBIG# | TL | 6ms | 3780kb | C++ | 1.1kb | 2022-09-04 15:38:40 | 2022-09-04 15:38:41 |
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*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;
}
}
cout << res << '\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3768kb
input:
2 3 2 5 1 6 3 4
output:
6 4 5 1 1 1
result:
ok 6 lines
Test #2:
score: 0
Accepted
time: 6ms
memory: 3772kb
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 37360 101052 189734 44388 58160 65320 201549 700 51480 7914 29608 23733 68146 15910 2508 7050 22338 2568 13820 39615 24063 17767 24217 3448 14760 4134 2862 3216 5190 8696 4324 25084 1422 16247 3712 1179 1868 2653 1495 11534 3536 7942 4479 746 6282 915 6734 6350 8724 6556 6150 2452 15366 12494...
result:
ok 2500 lines
Test #3:
score: 0
Accepted
time: 6ms
memory: 3672kb
input:
50 50 1486 846 1348 2280 1801 1630 1057 2035 323 2469 1053 2260 2277 2042 1591 2411 674 2116 498 2077 812 1872 691 708 2262 2130 1296 293 1915 1881 1592 2239 2303 1099 1833 2017 2021 1264 1543 2022 2498 421 1715 1995 393 790 1397 676 2418 1555 2218 1749 1664 697 1762 1462 800 1058 502 1358 309 497 8...
output:
277992 33319 214360 115155 17358 4830 17400 127440 105450 11644 16704 7400 44097 6393 13710 49596 5562 10080 8112 10060 28078 14262 1206 18779 15016 2712 22512 20870 11370 6180 6634 16716 4884 2865 8462 5840 612 5091 8166 2572 9942 7112 1434 1561 1337 4800 5048 6268 3996 2548 8964 7436 1286 4622 559...
result:
ok 2500 lines
Test #4:
score: 0
Accepted
time: 5ms
memory: 3780kb
input:
50 50 2138 647 2428 2499 1570 1856 1404 2335 211 1993 1780 1162 646 410 705 1883 732 2036 1329 1436 1000 216 2011 1202 1524 671 48 946 1811 941 299 1779 2250 1160 488 1469 2295 1163 1808 1886 1372 1217 1434 2060 1758 2349 414 986 1662 2085 1502 718 585 66 1988 2339 813 331 2419 246 38 593 2265 46 17...
output:
300352 78320 225170 16296 32757 46656 24400 7542 17048 67973 33512 33931 8688 37713 48200 16344 36000 7333 3575 14442 79926 1970 18516 10296 4762 11880 3240 406 9922 5954 5964 16860 2055 4036 669 802 1926 3418 414 4636 25615 365 3226 9721 5852 890 9450 972 13285 1350 2752 480 5812 9433 2258 11728 21...
result:
ok 2500 lines
Test #5:
score: -100
Time Limit Exceeded
input:
300 300 62869 36574 33553 12817 22897 15133 47681 36233 67491 54917 41006 49014 48160 44060 77045 79875 17268 87377 12861 38227 3522 81853 49342 29811 24853 60983 88195 36678 63004 36708 16597 40920 84626 70608 42409 47374 89927 53727 43606 83716 58162 10492 76055 13968 54935 31604 38043 36699 56552...
output:
393765372 269155380 54754056 7546000 65276530 99776526 122181756 35404200 20462562 22408074 33289900 34727878 6758056 36289968 10166076 27046512 37354240 17102202 38920984 38687188 26256600 17887259 4552960 9370878 7245018 13408417 8912512 10561978 3013340 29387090 10608876 4895032 1188744 7909580 2...