# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
147509 | ipaljak | Ispit (COCI19_ispit) | C++14 | 259 ms | 892 KiB |
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;
#define TRACE(x) cerr << #x << " " << x << endl
#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
typedef long long llint;
const int MOD = 1e9 + 7;
const int MAXN = 505;
bool ok[MAXN];
int n, k;
char s[MAXN][MAXN];
int main(void) {
scanf("%d%d", &n, &k);
for (int i = 0; i < n; ++i) scanf("%s", s[i]);
for (int j = 0; j < n; ++j) {
int cnt[26]; memset(cnt, 0, sizeof cnt);
for (int i = 0; i < n; ++i) {
++cnt[s[i][j] - 'a'];
if (cnt[s[i][j] - 'a'] > 1) ok[j] = true;
}
}
for (int i = 0; i < n; ++i) {
for (int j = i + 1; j < n; ++j) {
bool check = true;
int lo = n - 1, hi = 0;
for (int k = 0; k < n; ++k) {
if (s[i][k] == s[j][k]) continue;
if (!ok[k]) check = false;
lo = min(lo, k); hi = max(hi, k);
}
if (check && hi - lo + 1 <= k) {
printf("DA\n");
return 0;
}
}
}
printf("NE\n");
return 0;
}
Compilation message (stderr)
# | 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... |
# | 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... |