# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
104521 | Hassoony | Ispit (COCI19_ispit) | C++17 | 226 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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=(1e9+7);
const ll inf=(1ll<<61);
const int MX=502;
int n,p,c[MX];
char a[MX][MX];
int main(){
cin>>n>>p;
for(int i=0;i<n;i++)scanf("%s",&a[i]);
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
for(int k='a';k<='z';k++)c[k]=0;
int mn=MX,mx=-1;
for(int k=0;k<n;k++){
if(a[i][k]!=a[j][k]){
mn=min(mn,k);
mx=max(mx,k);
c[a[i][k]]++;
}
}
if(mx-mn+1>p)continue;
bool ok=1;
for(int k=0;k<n;k++){
if(a[i][k]!=a[j][k]){
if(c[a[j][k]])c[a[j][k]]--;
else ok=0;
}
}
if(ok){
puts("DA");
return 0;
}
}
}
puts("NE");
}
/*
4 2
abcd
acbd
enaa
moze
2 2
aa
aa
3 2
nec
uuc
iti
*/
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... |