Skip to content

Instantly share code, notes, and snippets.

@Pasi-D
Created November 27, 2016 18:16
Show Gist options
  • Select an option

  • Save Pasi-D/46382d5f5c8efb28c2e80ba62bdeeeaf to your computer and use it in GitHub Desktop.

Select an option

Save Pasi-D/46382d5f5c8efb28c2e80ba62bdeeeaf to your computer and use it in GitHub Desktop.
for _ in range(int(input())):
n = int(input())
mat = [list(map(int, input().split())) for _ in range(2*n)]
print (sum([max([mat[i][j],
mat[i][2*n-1-j],
mat[2*n-1-i][j],
mat[2*n-1-i][2*n-1-j]])
for i in range(n)
for j in range(n)]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment