#include <bits/stdc++.h>
using namespace std;
#define int long long
#define OYY 1000000000005
#define faster ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mid (start+end)/2
#define mod 1000000007
int dizi[1005][1005],x[1005][1005];
int32_t main(){
faster
int n,k;
cin>>n>>k;
char c;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cin>>c;
if(c=='o')dizi[i][j]=0;
else dizi[i][j]=1;
}
}
if(n==1){
cout<<"DA"<<'\n';
return 0;
}
bool stop=true;
int cev=0;
for(int i=1;i<n && stop;i++){
for(int j=1;j<n && stop;j++){
int sor=dizi[i-1][j-1]+dizi[i-1][j]+dizi[i][j-1]+dizi[i][j];
//cout<<sor<<endl;
if(sor%2!=0){
dizi[i][j]^=1;
cev++;
}
if(cev>k){
stop=false;
break;
}
}
}
if(stop)cout<<"DA"<<'\n';
else cout<<"NE"<<'\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
468 KB |
Output is correct |
2 |
Correct |
4 ms |
3540 KB |
Output is correct |
3 |
Correct |
5 ms |
4568 KB |
Output is correct |
4 |
Correct |
13 ms |
7896 KB |
Output is correct |
5 |
Correct |
5 ms |
4584 KB |
Output is correct |
6 |
Correct |
2 ms |
2516 KB |
Output is correct |
7 |
Correct |
6 ms |
4484 KB |
Output is correct |
8 |
Correct |
12 ms |
8012 KB |
Output is correct |
9 |
Correct |
2 ms |
1620 KB |
Output is correct |
10 |
Correct |
11 ms |
8116 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
468 KB |
Output is correct |
2 |
Correct |
1 ms |
596 KB |
Output is correct |
3 |
Incorrect |
1 ms |
724 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
6448 KB |
Output is correct |
2 |
Correct |
10 ms |
7060 KB |
Output is correct |
3 |
Correct |
7 ms |
5844 KB |
Output is correct |
4 |
Correct |
6 ms |
5588 KB |
Output is correct |
5 |
Correct |
12 ms |
7756 KB |
Output is correct |
6 |
Correct |
6 ms |
4800 KB |
Output is correct |
7 |
Correct |
9 ms |
6428 KB |
Output is correct |
8 |
Correct |
10 ms |
6652 KB |
Output is correct |
9 |
Correct |
3 ms |
3284 KB |
Output is correct |
10 |
Correct |
13 ms |
8508 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
7508 KB |
Output is correct |
2 |
Correct |
12 ms |
7372 KB |
Output is correct |
3 |
Correct |
7 ms |
5588 KB |
Output is correct |
4 |
Correct |
9 ms |
6260 KB |
Output is correct |
5 |
Correct |
9 ms |
6528 KB |
Output is correct |
6 |
Correct |
15 ms |
8356 KB |
Output is correct |
7 |
Correct |
4 ms |
4180 KB |
Output is correct |
8 |
Correct |
8 ms |
6188 KB |
Output is correct |
9 |
Correct |
8 ms |
6484 KB |
Output is correct |
10 |
Correct |
12 ms |
8508 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
5740 KB |
Output is correct |
2 |
Correct |
7 ms |
5716 KB |
Output is correct |
3 |
Incorrect |
13 ms |
8464 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
8668 KB |
Output is correct |
2 |
Correct |
13 ms |
8460 KB |
Output is correct |
3 |
Incorrect |
11 ms |
8028 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |