Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6. int n;
  7. cin>>n;
  8.  
  9. int a[n][n];
  10. for(int i=0;i<n;i++){
  11. for(int j=0;j<n;j++){
  12. cin>>a[i][j];
  13. }
  14. }
  15.  
  16. int colors[n];
  17. for(int i=0;i<n;i++){
  18. cin>>colors[i];
  19. }
  20.  
  21. int ans=0;
  22. for(int i=0;i<n;i++){
  23. int b;
  24. for(int j=i+1;j<n;j++){
  25. if(a[i][j]==1 && colors[i]!=colors[j]){
  26. ans++;
  27. }
  28. }
  29. }
  30.  
  31. cout<<ans;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement