#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;
assert(k!=n);
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 |
15 ms |
632 KB |
Output is correct |
3 |
Correct |
19 ms |
888 KB |
Output is correct |
4 |
Correct |
50 ms |
1272 KB |
Output is correct |
5 |
Correct |
23 ms |
892 KB |
Output is correct |
6 |
Correct |
11 ms |
504 KB |
Output is correct |
7 |
Correct |
36 ms |
888 KB |
Output is correct |
8 |
Correct |
113 ms |
1448 KB |
Output is correct |
9 |
Correct |
11 ms |
376 KB |
Output is correct |
10 |
Correct |
137 ms |
1400 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Runtime error |
5 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
1144 KB |
Output is correct |
2 |
Correct |
42 ms |
1272 KB |
Output is correct |
3 |
Correct |
31 ms |
1144 KB |
Output is correct |
4 |
Correct |
28 ms |
1144 KB |
Output is correct |
5 |
Correct |
49 ms |
1400 KB |
Output is correct |
6 |
Correct |
40 ms |
888 KB |
Output is correct |
7 |
Correct |
72 ms |
1144 KB |
Output is correct |
8 |
Correct |
81 ms |
1144 KB |
Output is correct |
9 |
Correct |
26 ms |
632 KB |
Output is correct |
10 |
Correct |
129 ms |
2396 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 |
28 ms |
1016 KB |
Output is correct |
4 |
Correct |
34 ms |
1144 KB |
Output is correct |
5 |
Correct |
37 ms |
1144 KB |
Output is correct |
6 |
Correct |
118 ms |
2296 KB |
Output is correct |
7 |
Correct |
34 ms |
632 KB |
Output is correct |
8 |
Correct |
68 ms |
1144 KB |
Output is correct |
9 |
Correct |
81 ms |
1144 KB |
Output is correct |
10 |
Correct |
136 ms |
2296 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
5 ms |
632 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
5 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |