Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <assert.h>
- #include <bits/stdc++.h>
- using namespace std;
- template <class T> using mpq = priority_queue<T, vector<T>, greater<T>>;
- using ll = long long;
- using pii = pair<int, int>;
- int t, n;
- int g[1 << 7][1 << 7];
- int main(int argc, char **argv)
- {
- // printf("hello world\n");
- scanf("%d", &t);
- while (t--) {
- scanf("%d", &n);
- // printf("t:%d, n:%d\n", t, n);
- for (int i = 0; i < n; ++i) {
- for (int j = 0; j < n; ++j) {
- scanf("%d", &g[i][j]);
- }
- }
- int total = 0;
- for (int i = 0; i < n / 2; ++i) {
- for (int j = 0; j < n / 2; ++j) {
- int ocnt = 0;
- ocnt += g[i][j];
- ocnt += g[n - j - 1][i];
- ocnt += g[n - i - 1][n - j - 1];
- ocnt += g[j][n - i - 1];
- total += min(ocnt, 4 - ocnt);
- }
- }
- printf("%d\n", total);
- }
- return 0;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement