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 <stdio.h>
#include <algorithm>
#include <memory.h>
#include <iostream>
int read(int x = 0, int f = 0, char ch = getchar())
{
while (ch < '0' or ch > '9')
f = ch == '-', ch = getchar();
while ('0' <= ch and ch <= '9')
x = x * 10 + (ch ^ 48), ch = getchar();
return f ? -x : x;
}
const int N = 1e3 + 5;
int n, k;
int a[N][N];
int main()
{
n = read(), k = read();
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
{
char ch;
std::cin >> ch;
a[i][j] = ch == 'x';
}
for (int T = 1; T <= n; T++)
{
int cnt = 0;
for (int i = 1; i <= n; i++)
{
cnt = 0;
for (int j = 1; j <= n; j++) cnt += a[i][j] == 0;
if (cnt * 2 > n)
for (int j = 1; j <= n; j++) a[i][j] ^= 1;
}
for (int j = 1; j <= n; j++)
{
cnt = 0;
for (int i = 1; i <= n; i++) cnt += a[i][j] == 0;
if (cnt * 2 > n)
for (int i = 1; i <= n; i++) a[i][j] ^= 1;
}
cnt = 0;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
cnt += a[i][j];
if (k + cnt >= n * n) return puts("DA"), 0;
}
return puts("NE"), 0;
}
# | 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... |