-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathVestigium .cpp
40 lines (38 loc) · 930 Bytes
/
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
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main() {
FASTIO
int t;
cin >> t;
for(int z=0;z<t;z++){
int n,trace=0,r=0,c=0;
cin >> n;
vector<vector<int>> arr(n,vector<int> (n,0));
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
cin>>arr[i][j];
set<int> k;
for(int i=0;i<n;i++){
trace+=arr[i][i];
}
for(int i=0;i<n;i++){
k.clear();
for(int j=0;j<n;j++){
k.insert(arr[i][j]);
}
if(k.size()<n)
r++;
}
for(int j=0;j<n;j++){
k.clear();
for(int i=0;i<n;i++){
k.insert(arr[i][j]);
}
if(k.size()<n)
c++;
}
cout << "Case #" << z+1 << ": " <<trace << " "<< r<< " " << c << "\n";
}
return 0;
}