#include<bits/stdc++.h>
using namespace std;
#define int long long
#define X first
#define Y second
int n;int K;
int gr[1010][1010];
int ogr[1010][1010];
int rsame(int r){
for(int i=1;i<=n;i++){
if(gr[r][i]!=gr[r][1]){return 0;}
}
return 1;
}
void solve(){
for(int i=1;i<=n;i++){
if(gr[1][i]==0){
for(int j=1;j<=n;j++){
gr[j][i]^=1;
}
}
}
for(int i=1;i<=n;i++){
if(rsame(i)==0){return;}
}
cout<<"DA\n";exit(0);
}
signed main(){
cin>>n>>K;
for(int i=1;i<=n;i++){
string s;
cin>>s;
s="*"+s;
for(int j=1;j<=n;j++){
if(s[j]=='o'){
gr[i][j]=0;
}else{
gr[i][j]=1;
}
ogr[i][j]=gr[i][j];
}
}
solve();
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
gr[i][j]=ogr[i][j];
}
}
for(int i=1;i<=n;i++){
gr[1][i]^=1;
}
solve();
cout<<"NE\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
6 ms |
6592 KB |
Output is correct |
3 |
Correct |
7 ms |
8660 KB |
Output is correct |
4 |
Correct |
19 ms |
15436 KB |
Output is correct |
5 |
Correct |
8 ms |
8732 KB |
Output is correct |
6 |
Correct |
4 ms |
4608 KB |
Output is correct |
7 |
Correct |
7 ms |
8360 KB |
Output is correct |
8 |
Correct |
20 ms |
15828 KB |
Output is correct |
9 |
Correct |
2 ms |
2900 KB |
Output is correct |
10 |
Correct |
21 ms |
15888 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
696 KB |
Output is correct |
2 |
Incorrect |
1 ms |
852 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
15 ms |
12756 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
14664 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
10912 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
25 ms |
16948 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |