#include <bits/stdc++.h>
using namespace std;
string arr[1005];
bitset<1005> bit[1005];
int co[1005];
int n,k;
int main()
{
cin >> n >> k;
for(int i=0;i<n;i++)
{
cin >> arr[i];
for(int j=0;j<n;j++)
{
arr[i][j]=(arr[i][j]=='o'?'1':'0');
}
bit[i]=bitset<1005>(arr[i]);
}
for(int i=0;i<n;i++)
{
int cur=0;
for(int j=0;j<n;j++)
{
int z=(bit[i]^bit[j]).count();
cur+=min(z,n-z);
}
if(cur<=k)
{
cout << "DA" << endl;
return 0;
}
}
cout << "NE" << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
14 ms |
632 KB |
Output is correct |
3 |
Correct |
20 ms |
888 KB |
Output is correct |
4 |
Correct |
156 ms |
1272 KB |
Output is correct |
5 |
Correct |
20 ms |
888 KB |
Output is correct |
6 |
Correct |
11 ms |
504 KB |
Output is correct |
7 |
Correct |
35 ms |
760 KB |
Output is correct |
8 |
Correct |
110 ms |
1332 KB |
Output is correct |
9 |
Correct |
11 ms |
376 KB |
Output is correct |
10 |
Correct |
114 ms |
1332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Incorrect |
6 ms |
376 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
1144 KB |
Output is correct |
2 |
Correct |
43 ms |
1272 KB |
Output is correct |
3 |
Correct |
30 ms |
1144 KB |
Output is correct |
4 |
Correct |
27 ms |
1016 KB |
Output is correct |
5 |
Correct |
52 ms |
1372 KB |
Output is correct |
6 |
Correct |
40 ms |
1016 KB |
Output is correct |
7 |
Correct |
69 ms |
1144 KB |
Output is correct |
8 |
Correct |
78 ms |
1144 KB |
Output is correct |
9 |
Correct |
24 ms |
632 KB |
Output is correct |
10 |
Correct |
125 ms |
2424 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
47 ms |
1272 KB |
Output is correct |
2 |
Correct |
44 ms |
1272 KB |
Output is correct |
3 |
Correct |
27 ms |
1016 KB |
Output is correct |
4 |
Correct |
35 ms |
1144 KB |
Output is correct |
5 |
Correct |
36 ms |
1144 KB |
Output is correct |
6 |
Correct |
118 ms |
2296 KB |
Output is correct |
7 |
Correct |
32 ms |
632 KB |
Output is correct |
8 |
Correct |
67 ms |
1144 KB |
Output is correct |
9 |
Correct |
74 ms |
1144 KB |
Output is correct |
10 |
Correct |
138 ms |
2296 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
1144 KB |
Output is correct |
2 |
Correct |
28 ms |
1016 KB |
Output is correct |
3 |
Incorrect |
119 ms |
2296 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
60 ms |
2400 KB |
Output is correct |
2 |
Correct |
57 ms |
2296 KB |
Output is correct |
3 |
Incorrect |
109 ms |
1400 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |