This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
}
for (int i=0;i<n;i++)
{
b[0][i].flip();
int cur=0;
for (int j=0;j<n;j++)
cur+=get(0,j);
if (cur<=k)
{
cout << "DA";
return 0;
}
b[0][i].flip();
}
cout << "NE";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |