# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
159276 | socho | Ispit (COCI19_ispit) | C++14 | 628 ms | 1144 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;
bool comp(string a, string b) {
int aoc[26], boc[26];
memset(aoc, 0, sizeof aoc); memset(boc, 0, sizeof boc);
for (int i=0; i<a.size(); i++) {
aoc[a[i]-'a']++;
boc[b[i]-'a']++;
}
for (int i=0; i<26; i++) {
if (aoc[i] != boc[i]) return false;
}
return true;
}
int main() {
int n, k;
cin >> n >> k;
string arr[n];
for (int i=0; i<n; i++) {
cin >> arr[i];
}
int mn = INT_MAX;
for (int i=0; i<n; i++) {
for (int j=i+1; j<n; j++) {
if (comp(arr[i], arr[j])) {
int leftmis = INT_MAX;
int rightmis = INT_MIN;
for (int k=0; k<n; k++) {
if (arr[i][k] != arr[j][k]) {
leftmis = min(leftmis, k);
rightmis = max(rightmis, k);
}
}
if (leftmis == INT_MAX) {
mn = 0;
}
else {
mn = min(mn, rightmis-leftmis+1);
}
}
}
}
if (mn <= k) {
cout << "DA" << endl;
}
else {
cout << "NE" << endl;
}
}
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... |