# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
147510 | ipaljak | Ispit (COCI19_ispit) | C++14 | 196 ms | 888 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;
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 i = 0; i < n; ++i) {
for (int j = i + 1; j < n; ++j) {
int lo = n - 1, hi = 0;
for (int k = 0; k < n; ++k) {
if (s[i][k] == s[j][k]) continue;
lo = min(lo, k); hi = max(hi, k);
}
if (hi - lo + 1 > k) continue;
int cnti[26], cntj[26];
memset(cnti, 0, sizeof cnti);
memset(cntj, 0, sizeof cntj);
for (int k = lo; k <= hi; ++k) {
cnti[s[i][k] - 'a']++;
cntj[s[j][k] - 'a']++;
}
bool check = true;
for (int k = 0; k < 26; ++k)
check &= cnti[k] == cntj[k];
if (check) {
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... |