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>
#define pb push_back
#define whole(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using namespace std;
typedef long long ll;
typedef long double ld;
const int N = (int)1e5 + 7;
const int INF = (int)1e9 + 7;
const ll linf = (ll)1e18 + 1;
int a[1005][1005];
int main() {
int n, k; cin >> n >> k;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= n; ++j) {
char ch; cin >> ch;
a[i][j] = (ch == 'x') ? 1 : 0;
}
}
for (int turn = 1; turn <= n; ++turn) {
for (int i = 1; i <= n; ++i) {
int cnt = 0;
for (int j = 1; j <= n; ++j) cnt += (a[i][j] == 0);
if (2 * cnt > n) {
for (int j = 1; j <= n; ++j) a[i][j] = (a[i][j] ^ 1);
}
}
for (int j = 1; j <= n; ++j) {
int cnt = 0;
for (int i = 1; i <= n; ++i) cnt += (a[i][j] == 0);
if (2 * cnt > n) {
for (int i = 1; i <= n; ++i) a[i][j] = (a[i][j] ^ 1);
}
}
int kol = 0;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= n; ++j) kol += a[i][j];
}
if (n * n - kol <= k) return cout << "DA\n", 0;
}
cout << "NE\n";
return 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... |