-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvestigium.cpp
49 lines (46 loc) · 1.12 KB
/
vestigium.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <bits/stdc++.h>
#define endl "\n"
#define eat cin
#define moo cout
using namespace std;
int T, N, m[100][100];
int32_t main(){
eat.tie(0) -> sync_with_stdio(0);
eat >> T;
for(int tc = 1; tc <= T; tc++){
moo << "Case #" << tc << ": ";
eat >> N;
for(int i = 0; i < N; i++){
for(int j = 0; j < N; j++){
eat >> m[i][j];
}
}
int trace = 0;
for(int i = 0; i < N; i++){
trace += m[i][i];
}
int r = 0;
for(int i = 0; i < N; i++){
set<int> s;
for(int j = 0; j < N; j++){
if(s.count(m[i][j])){
r++;
break;
}
s.insert(m[i][j]);
}
}
int c = 0;
for(int i = 0; i < N; i++){
set<int> s;
for(int j = 0; j < N; j++){
if(s.count(m[j][i])){
c++;
break;
}
s.insert(m[j][i]);
}
}
moo << trace << " " << r << " " << c << endl;
}
}