General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
187616450 Practice:
DaiRuiChen007
1621D - 20 C++14 (GCC 6-32) Accepted 78 ms 9836 KB 2023-01-02 16:12:10 2023-01-02 16:12:10
→ Source
// LUOGU_RID: 98535215
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN=501,INF=1e18;
int c[MAXN][MAXN],dp[MAXN][MAXN][4];
inline void solve() {
	int n,cost=0;
	scanf("%lld",&n);
	for(int i=1;i<=2*n;++i) {
		for(int j=1;j<=2*n;++j) {
			scanf("%lld",&c[i][j]);
			if(i>n&&j>n) cost+=c[i][j];
		}
	}
	printf("%lld\n",min(min(min(c[1][n+1],c[1][n*2]),min(c[n][n+1],c[n][n*2])),
						min(min(c[n+1][1],c[n+1][n]),min(c[n*2][1],c[n*2][n])))+cost);
}
signed main() {
	int T;
	scanf("%lld",&T);
	while(T--) solve();
	return 0;
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details