# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100864 | Ort | Ispit (COCI19_ispit) | C++11 | 27 ms | 896 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<iostream>
#include<string>
#include<algorithm>
#define MAX 505
using namespace std;
int n, k;
string mat[MAX];
string smat[MAX];
string s;
int main() {
cin.sync_with_stdio(0); cin.tie(0);
cin.exceptions(cin.failbit);
cin >> n >> k;
for(int i=0;i<n;i++) {cin >> s;mat[i] = s;sort(s.begin(),s.end());smat[i] = s;}
int cnt = 0;
for(int i=0;i<n;i++) {
for(int j=0;j<n;j++) {
if(i==j) continue;
if(smat[i]==smat[j]) {
int a = 0, b = 0;
for(int z=0;z<n;z++)
if(mat[i][z]==mat[j][z]) a++;
else break;
for(int z=n-1;z>=0;z--)
if(mat[i][z]==mat[j][z]) b++;
else break;
if(n-a-b<=k) {
cout << "DA";
return 0;
}
}
}
}
cout << "NE";
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... |