# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
198856 | ZwariowanyMarcin | Ispit (COCI19_ispit) | C++14 | 37 ms | 764 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>
#define fi first
#define se second
#define mp make_pair
#define ss(x) (int) x.size()
#define pb push_back
#define LL long long
#define ld long double
#define cat(x) cerr << #x << " = " << x << endl
#define FOR(i, j, n) for(int i = j; i <= n; ++i)
#define boost cin.tie(0), ios_base::sync_with_stdio(0);
using namespace std;
const int nax = 510;
int n, k;
char s[nax][nax];
void tak() {
printf ("DA");
exit(0);
}
void nie() {
printf ("NE");
exit(0);
}
int t[2][26];
int main() {
scanf ("%d%d", &n, &k);
for (int i = 1; i <= n; ++i)
scanf ("%s", s[i] + 1);
for (int i = 1; i <= n; ++i)
for (int j = i + 1; j <= n; ++j) {
int l = 1;
int r = n;
while (l <= n && s[i][l] == s[j][l]) l++;
while (1 <= r && s[i][r] == s[j][r]) r--;
if (l == n) tak();
if (r - l + 1 > k) continue;
for (int j = 0; j < 2; ++j)
for (int c = 0; c < 26; ++c)
t[j][c] = 0;
for (int k = l; k <= r; ++k) {
t[0][s[i][k] - 'a']++;
t[1][s[j][k] - 'a']++;
}
bool ok = 1;
for (int c = 0; c < 26; ++c)
if (t[0][c] != t[1][c]) ok = 0;
if (ok) tak();
}
nie();
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... |