Created
April 4, 2020 12:56
-
-
Save Peelz/b5a92743880c1ceccb5d606792510606 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
numCase = int(input()) | |
for c in range(numCase): | |
size = int(input()) | |
matrix = [] | |
rowCount = 0 | |
colCount = 0 | |
tranceCount = 0 | |
for i in range(size): | |
matrix.append(input().split(" ")) | |
# row | |
for row in range(size): | |
# m = {} | |
m = set() | |
checked = 0 | |
tranceCount+=int(matrix[row][row]) | |
for col in range(size): | |
v = matrix[row][col] | |
if v in m and not checked: | |
checked = 1 | |
rowCount += 1 | |
row+=1 | |
if row == size: | |
break | |
else: | |
m.add(v) | |
for col in range(size): | |
m = set() | |
checked = 0 | |
for row in range(size): | |
v = matrix[row][col] | |
if v in m and not checked: | |
checked = 1 | |
colCount += 1 | |
col += 1 | |
if col == size: | |
break | |
else: | |
m.add(v) | |
print(f"Case #{c+1}: {tranceCount} {rowCount} {colCount}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment