-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVestigium.cpp
More file actions
63 lines (51 loc) · 1.21 KB
/
Vestigium.cpp
File metadata and controls
63 lines (51 loc) · 1.21 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int t; cin>>t;
for(int T=1; T<=t; T++)
{
int n; cin>>n;
vector< vector<int> > v;
for(int i=0; i<n; i++)
{
vector<int> row;
for(int j=0; j<n; j++)
{
int x; cin>>x;
row.push_back(x);
}
v.push_back(row);
}
int sum = 0;
int r = 0;
int c = 0;
for(int i=0; i<n; i++)
{
map<int,int> mR;
map<int,int> mC;
bool flagR = false;
bool flagC = false;
for(int j=0; j<n; j++)
{
if(i==j) sum+=+v[i][j];
mR[v[i][j]]++;
mC[v[j][i]]++;
if(mR[v[i][j]] > 1)
{
flagR = true;
}
if(mC[v[j][i]] > 1)
{
flagC = true;
}
}
if(flagR==true) r++;
if(flagC==true) c++;
}
cout<<"Case #"<<T<<": "<<sum<<" "<<r<<" "<<c<<"\n";
}
}