fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int size;
  6. cin >> size;
  7. int strictlyAscending = 1;
  8. for (int line = 1; line <= size; ++line) {
  9. for (int col = 1; col <= size; ++col) {
  10. int currentEl;
  11. cin >> currentEl;
  12. if (line == col){
  13. int previousEl;
  14. if (line > 1 && currentEl <= previousEl) {
  15. strictlyAscending = 0;
  16. }
  17. previousEl = currentEl;
  18. }
  19. }
  20. }
  21. if (strictlyAscending) {
  22. cout << "DA";
  23. } else {
  24. cout << "NU";
  25. }
  26. return 0;
  27. }
Success #stdin #stdout 0s 5292KB
stdin
5
1 8 7 6 5
5 6 4 3 2
10 12 11 13 14
18 17 16 16 14
12 13 14 15 16
	NU
stdout
NU