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;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef pair<pi,int> pii;
#define pb emplace_back
#define mp make_pair
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define ALL(X) X.begin(),X.end()
#define SZ(X) (int)X.size()
#define MAXN 510
#define INF 1e15
unordered_map<string,bool> M;
string A[MAXN];
int N,K;
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
// freopen("in.txt","r",stdin);
cin>>N>>K;
for (int i=1;i<=N;++i)cin>>A[i];
for (int l=0;l+K<=N;++l){
int r=l+K-1;
// cout<<l<<' '<<r<<'\n';
M.clear();
for (int j=1;j<=N;++j){
string tmp = "", st = "";
for (int i=0;i<l;++i)tmp += A[j][i];
for (int i=r+1;i<N;++i)tmp += A[j][i];
for (int i=l;i<=r;++i)st+=A[j][i];
sort(ALL(st));
for (auto i :st)tmp+=i;
if (M[tmp] == 1){
cout<<"DA";
return 0;
}
else M[tmp]=1;
}
}
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... |