Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n;
  6. bool w=true;
  7. int m=0;
  8. int x,y;
  9. int arr[50+5][50+5];
  10. cin>>n;
  11. for(int i=0; i<n; i++)
  12. {
  13. for(int j=0; j<n; j++)
  14. {
  15. int a;
  16. cin>>a;
  17. arr[i][j]=a;
  18. if(a!=1)w=false;
  19. if(a>m)
  20. {
  21. m=a;
  22. x=i;
  23. y=j;
  24. }
  25. }
  26. }
  27. if(w)
  28. {
  29. cout<<"No"<<endl;
  30. return 0;
  31. }
  32. else
  33. for(int i=0; i<n-1; i++)
  34. {
  35. for(int j=0; j<n-1; j++)
  36. {
  37. if(x==i && y==j)continue;
  38. if(arr[x][y]==arr[x][i]+arr[j][y])
  39. {
  40. cout<<"Yes"<<endl;
  41. return 0;
  42. }
  43. }
  44. }
  45. cout<<"No"<<endl;
  46.  
  47. return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement