This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//author: Ahmet Alp Orakci
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
const int MAXN = 1E3 + 5;
char matrix[MAXN][MAXN];
#define ONLINE_JUDGE
void solve() {
memset(matrix, 'x', sizeof(matrix));
int n, k;
cin >> n >> k;
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= n; j++) {
cin >> matrix[i][j];
}
}
auto reversex = [&](int x) -> void {
for(int i = 1; i <= n; i++) {
matrix[x][i] = (matrix[x][i] == 'o' ? 'x' : 'o');
}
};
for(int i = 1; i <= n -1; i++) {
if(matrix[i][1] != matrix[i +1][1]) {
reversex(i +1);
}
}
bool ans = true;
for(int i = 1; i <= n -1; i++) {
for(int j = 1; j <= n; j++) {
ans &= matrix[i][j] == matrix[i +1][j];
}
}
cout << (ans ? "DA" : "NE");
return;
}
signed main() {
#ifndef ONLINE_JUDGE
freopen(".in", "r", stdin);
freopen(".out", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int t = 1; //cin >> t;
for(int i = 1; i <= t; i++) {
solve();
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |