Advertisement
Mirbek

Цветной дождь

Jan 8th, 2022
748
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. long long n, A[105][105], a[105], res;
  5. int main() {
  6.  
  7.  
  8.     cin >> n;
  9.  
  10.     for(int i = 1; i <= n; i ++)
  11.         for(int j = 1; j <= n; j ++)
  12.             cin >> A[i][j];
  13.  
  14.     for(int i = 1; i <= n; i ++)
  15.         cin >> a[i];
  16.  
  17.     for(int i = 1; i <= n; i ++){
  18.         for(int j = 1; j <= n; j ++){
  19.             if(A[i][j] == 1)
  20.                if(a[i] != a[j]) res ++;
  21.         }
  22.     }
  23.  
  24.     cout << res / 2 << endl;
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement