Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, m;
- cin >> n >> m;
- int mat[n][m];
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < m; j++) {
- cin >> mat[i][j];
- }
- }
- bool ok = true;
- for(int j = 0; j < m - 1; j++) {
- int najgolem = mat[0][j];
- int najgolem2 = mat[0][j + 1];
- for(int i = 0; i < n; i++) {
- if(mat[i][j] > najgolem) {
- najgolem = mat[i][j];
- }
- if(mat[i][j + 1] > najgolem2) {
- najgolem2 = mat[i][j + 1];
- }
- }
- if(najgolem >= najgolem2) {
- ok = false;
- break;
- }
- }
- if(ok) {
- cout << "DA" << endl;
- }
- else {
- cout << "NE" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment