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;
int n, k, s, e;
string a[505], b[505];
int main(){
cin >> n >> k;
for(int i = 0; i < n; i++){
cin >> a[i]; b[i] = a[i];
sort(b[i].begin(), b[i].end());
}
for(int i = 0; i < n; i++){
for(int j = 0; j < i; j++){
if(b[i] != b[j]) continue;
s = n;
e = 0;
for(int l = 0; l < n; l++){
if(a[i][l] != a[j][l]){
s = min(s, l);
e = max(e, l);
}
}
if((e-s+1) <= k){ cout << "DA"; return 0; }
}
}
cout << "NE";
}
# | 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... |