# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
313951 | 2020-10-17T14:29:17 Z | phathnv | Ispit (COCI19_ispit) | C++11 | 333 ms | 768 KB |
#include <bits/stdc++.h> #define mp make_pair #define X first #define Y second #define taskname "ISPIT" using namespace std; typedef long long ll; typedef pair <int, int> ii; const int N = 502; int n, k; char a[N][N]; int d[26]; void readInput(){ scanf("%d %d", &n, &k); for(int i = 1; i <= n; i++) scanf("%s", a[i] + 1); } bool check(int x1, int x2){ for(int i = 0; i < 26; i++) d[i] = 0; int minP = n, maxP = 0; for(int i = 1; i <= n; i++) if (a[x1][i] != a[x2][i]){ minP = min(minP, i); maxP = max(maxP, i); d[a[x1][i] - 'a']++; d[a[x2][i] - 'a']--; } if (maxP - minP + 1 > k) return 0; for(int i = 0; i < 26; i++) if (d[i] != 0) return 0; return 1; } void solve(){ for(int x1 = 1; x1 <= n; x1++) for(int x2 = x1 + 1; x2 <= n; x2++) if (check(x1, x2)){ printf("DA"); return; } printf("NE"); } int main(){ if (fopen(taskname".inp", "r")){ freopen(taskname".inp", "r", stdin); freopen(taskname".out", "w", stdout); } readInput(); solve(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 288 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 0 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 0 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 0 ms | 384 KB | Output is correct |
4 | Correct | 0 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 384 KB | Output is correct |
2 | Correct | 12 ms | 384 KB | Output is correct |
3 | Correct | 17 ms | 384 KB | Output is correct |
4 | Correct | 14 ms | 496 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 384 KB | Output is correct |
2 | Correct | 18 ms | 384 KB | Output is correct |
3 | Correct | 18 ms | 384 KB | Output is correct |
4 | Correct | 14 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 384 KB | Output is correct |
2 | Correct | 15 ms | 384 KB | Output is correct |
3 | Correct | 14 ms | 384 KB | Output is correct |
4 | Correct | 16 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 384 KB | Output is correct |
2 | Correct | 3 ms | 384 KB | Output is correct |
3 | Correct | 21 ms | 384 KB | Output is correct |
4 | Correct | 15 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 333 ms | 632 KB | Output is correct |
2 | Correct | 250 ms | 632 KB | Output is correct |
3 | Correct | 132 ms | 512 KB | Output is correct |
4 | Correct | 217 ms | 768 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 333 ms | 632 KB | Output is correct |
2 | Correct | 109 ms | 512 KB | Output is correct |
3 | Correct | 265 ms | 512 KB | Output is correct |
4 | Correct | 240 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 328 ms | 512 KB | Output is correct |
2 | Correct | 56 ms | 512 KB | Output is correct |
3 | Correct | 193 ms | 632 KB | Output is correct |
4 | Correct | 204 ms | 768 KB | Output is correct |