QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#764156 | #8519. Radars | ucup-team004 | WA | 0ms | 3608kb | C++23 | 1.9kb | 2024-11-20 01:44:25 | 2024-11-20 01:44:26 |
Judging History
answer
#include <bits/stdc++.h>
using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
using u128 = unsigned __int128;
constexpr i64 inf = 1E18;
void chmin(i64 &a, i64 b) {
if (a > b) {
a = b;
}
}
void solve() {
int n;
std::cin >> n;
std::vector a(n, std::vector<int>(n));
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
std::cin >> a[i][j];
}
}
i64 ans = inf;
i64 lu = inf, ld = inf, ru = inf, rd = inf;
i64 l = inf, r = inf, u = inf, d = inf;
int m = n / 2;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i <= m && j <= m) {
chmin(lu, a[i][j]);
}
if (i <= m && j >= m) {
chmin(ru, a[i][j]);
}
if (i >= m && j <= m) {
chmin(ld, a[i][j]);
}
if (i >= m && j <= m) {
chmin(rd, a[i][j]);
}
if (i <= m && j == m) {
chmin(u, a[i][j]);
}
if (i >= m && j == m) {
chmin(d, a[i][j]);
}
if (i == m && j <= m) {
chmin(l, a[i][j]);
}
if (i == m && j >= m) {
chmin(r, a[i][j]);
}
if (i == m && j == m) {
chmin(ans, a[i][j]);
}
}
}
chmin(ans, lu + ld + ru + rd);
chmin(ans, l + ru + rd);
chmin(ans, r + lu + ld);
chmin(ans, u + ld + rd);
chmin(ans, d + lu + ru);
chmin(ans, l + r);
chmin(ans, u + d);
std::cout << ans << "\n";
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int t;
std::cin >> t;
while (t--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3560kb
input:
2 3 1 1 1 1 1 1 1 1 1 5 8 5 2 8 3 5 6 9 7 3 7 8 9 1 4 8 9 4 5 5 2 8 6 9 3
output:
1 5
result:
ok 2 number(s): "1 5"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
1 1 444739567
output:
444739567
result:
ok 1 number(s): "444739567"
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3608kb
input:
32 5 177252602 814271963 432801178 401470194 888319541 320323627 34071000 116035631 87392694 926990496 423510770 515133425 777623990 140441392 853473387 976288681 925949889 930584554 939702106 761328886 840677679 912446055 378955738 997133668 334407172 3 633852912 89450314 828384045 327867173 732812...
output:
494991369 661643843 65563848 226890388 50684672 954430705 139405747 530064327 199272913 211829225 333898451 248407763 35580250 251879512 186551709 60323753 213322503 114032585 234835995 299715204 49710371 75128942 269414925 755829169 86815121 89695065 691515792 193230413 469380143 156043031 22714188...
result:
wrong answer 3rd numbers differ - expected: '47298040', found: '65563848'