Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define INF INT_MAX
- #define LINF LLONG_MAX
- #define forin(data) for(auto &i : data)
- #define debug(x) cerr << #x << " = " << x << endl;
- using ll = long long;
- using pi = pair<int, int>;
- using vi = vector<int>;
- using vii = vector<vi>;
- using vl = vector<ll>;
- void init(){
- #ifdef LOCAL
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- freopen("log.txt", "w", stderr);
- #else
- cin.tie(0); cout.tie(0);
- ios_base::sync_with_stdio(0);
- #endif
- }
- int main(){
- init();
- int tc;
- cin >> tc;
- for(int i=1; i<=tc; i++){
- int n;
- cin >> n;
- int arr[n][n];
- int sum, row, col;
- sum = row = col = 0;
- for(int j=0; j<n; j++){
- set<int> ele;
- for(int k=0; k<n; k++){
- cin >> arr[j][k];
- ele.insert(arr[j][k]);
- }
- if(ele.size() != n){
- row++;
- }
- }
- for(int j=0; j<n; j++){
- set<int> ele;
- for(int k=0; k<n; k++){
- ele.insert(arr[k][j]);
- }
- if(ele.size() != n){
- col++;
- }
- }
- for(int j=0; j<n; j++){
- sum += arr[j][j];
- }
- printf("Case #%d: %d %d %d\n", i, sum, row, col);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment