#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
//#define endl "\n"
#define ll long long
#define pb push_back
#define N 1005
#define f first
#define s second
#define M 17
int dp[N];
int main(){
int n,k;cin>>n>>k;
int ilk[n];
string str;cin>>str;
for(int i=0;i<n;i++){
ilk[i]=(str[i]=='o');
}
int arr[n-1][n];
for(int i=0;i<n-1;i++){
cin>>str;
for(int j=0;j<n;j++){
int a=(str[j]=='o');
arr[i][j]=ilk[j]^a;
}
}
//cout<<ilk[0]<<" "<<ilk[1]<<endl;
//cout<<arr[0][0]<<" "<<arr[0][1]<<endl;
ll int cev=0;
for(int i=0;i<n-1;i++){
for(int j=0;j<n;j++){
dp[i]+=arr[i][j];
}
if(dp[i]<=n-dp[i])cev+=dp[i];
else cev+=(n-dp[i]);
}
if(cev<=k)cout<<"DA"<<endl;
else cout<<"NE"<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
280 KB |
Output is correct |
2 |
Correct |
3 ms |
1168 KB |
Output is correct |
3 |
Correct |
5 ms |
1492 KB |
Output is correct |
4 |
Correct |
14 ms |
3804 KB |
Output is correct |
5 |
Correct |
5 ms |
1596 KB |
Output is correct |
6 |
Correct |
2 ms |
808 KB |
Output is correct |
7 |
Correct |
5 ms |
1492 KB |
Output is correct |
8 |
Correct |
14 ms |
4044 KB |
Output is correct |
9 |
Correct |
1 ms |
468 KB |
Output is correct |
10 |
Correct |
16 ms |
4120 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
312 KB |
Output is correct |
3 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
2820 KB |
Output is correct |
2 |
Correct |
12 ms |
3284 KB |
Output is correct |
3 |
Correct |
8 ms |
2496 KB |
Output is correct |
4 |
Correct |
7 ms |
2260 KB |
Output is correct |
5 |
Correct |
14 ms |
3740 KB |
Output is correct |
6 |
Correct |
5 ms |
1620 KB |
Output is correct |
7 |
Correct |
9 ms |
2820 KB |
Output is correct |
8 |
Correct |
10 ms |
3004 KB |
Output is correct |
9 |
Correct |
3 ms |
1088 KB |
Output is correct |
10 |
Correct |
17 ms |
4684 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
3604 KB |
Output is correct |
2 |
Correct |
12 ms |
3512 KB |
Output is correct |
3 |
Correct |
7 ms |
2260 KB |
Output is correct |
4 |
Correct |
9 ms |
2752 KB |
Output is correct |
5 |
Correct |
10 ms |
2864 KB |
Output is correct |
6 |
Correct |
15 ms |
4260 KB |
Output is correct |
7 |
Correct |
4 ms |
1336 KB |
Output is correct |
8 |
Correct |
9 ms |
2684 KB |
Output is correct |
9 |
Correct |
10 ms |
2852 KB |
Output is correct |
10 |
Correct |
17 ms |
4468 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
2332 KB |
Output is correct |
2 |
Correct |
7 ms |
2308 KB |
Output is correct |
3 |
Incorrect |
16 ms |
4404 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
4556 KB |
Output is correct |
2 |
Correct |
16 ms |
4284 KB |
Output is correct |
3 |
Incorrect |
14 ms |
4040 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |