#include <bits/stdc++.h>
using namespace std;
int n,k;
string s[1005];
bitset<1005> b[1005];
int get(int i,int j)
{
int cnt=(b[i]^b[j]).count();
return min(cnt,n-cnt);
}
int main()
{
cin >> n >> k;
for (int i=0;i<n;i++)
{
cin >> s[i];
for (int j=0;j<n;j++)
b[i][j]=(s[i][j]=='o');
}
for (int i=0;i<n;i++)
{
int cur=0;
for (int j=0;j<n;j++)
cur+=get(i,j);
if (cur<=k)
{
cout << "DA";
return 0;
}
}
cout <<"NE"<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
10 ms |
768 KB |
Output is correct |
3 |
Correct |
14 ms |
1152 KB |
Output is correct |
4 |
Correct |
42 ms |
2168 KB |
Output is correct |
5 |
Correct |
15 ms |
1152 KB |
Output is correct |
6 |
Correct |
6 ms |
640 KB |
Output is correct |
7 |
Correct |
33 ms |
1152 KB |
Output is correct |
8 |
Correct |
108 ms |
2168 KB |
Output is correct |
9 |
Correct |
7 ms |
512 KB |
Output is correct |
10 |
Correct |
110 ms |
2168 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
1656 KB |
Output is correct |
2 |
Correct |
35 ms |
1912 KB |
Output is correct |
3 |
Correct |
25 ms |
1536 KB |
Output is correct |
4 |
Correct |
22 ms |
1408 KB |
Output is correct |
5 |
Correct |
41 ms |
2168 KB |
Output is correct |
6 |
Correct |
36 ms |
1280 KB |
Output is correct |
7 |
Correct |
67 ms |
1664 KB |
Output is correct |
8 |
Correct |
73 ms |
1784 KB |
Output is correct |
9 |
Correct |
21 ms |
768 KB |
Output is correct |
10 |
Correct |
123 ms |
3380 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
2064 KB |
Output is correct |
2 |
Correct |
37 ms |
2044 KB |
Output is correct |
3 |
Correct |
22 ms |
1408 KB |
Output is correct |
4 |
Correct |
28 ms |
1656 KB |
Output is correct |
5 |
Correct |
30 ms |
1784 KB |
Output is correct |
6 |
Correct |
115 ms |
3320 KB |
Output is correct |
7 |
Correct |
29 ms |
896 KB |
Output is correct |
8 |
Correct |
64 ms |
1700 KB |
Output is correct |
9 |
Correct |
73 ms |
1784 KB |
Output is correct |
10 |
Correct |
121 ms |
3448 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
1536 KB |
Output is correct |
2 |
Correct |
23 ms |
1528 KB |
Output is correct |
3 |
Incorrect |
120 ms |
3320 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
51 ms |
3320 KB |
Output is correct |
2 |
Correct |
49 ms |
3320 KB |
Output is correct |
3 |
Incorrect |
105 ms |
2296 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |