Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. ifstream fin;
  8. ofstream fout;
  9. fin.open("input.txt");
  10. fout.open("output.txt");
  11. int points;
  12. fin >> points;
  13. int** arr = new int* [points];
  14. for (int i = 0; i < points; i++)
  15. {
  16. arr[i] = new int[points];
  17. }
  18.  
  19. for (int i = 0; i < points; i++)
  20. {
  21. for (int j = 0; j < points; j++)
  22. {
  23. fin >> arr[i][j];
  24. }
  25. }
  26.  
  27. for (int i = 0; i < points; i++)
  28. {
  29. for (int j = 0; j < points; j++)
  30. {
  31. if (arr[i][j] != arr[j][i])
  32. {
  33. fout << "NO";
  34. return -1;
  35. }
  36. if (i == j && arr[i][j] == 1)
  37. {
  38. fout << "NO";
  39. return -2;
  40. }
  41. }
  42. }
  43. fout << "YES";
  44. fin.close();
  45. fout.close();
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement