Submission #250765

#TimeUsernameProblemLanguageResultExecution timeMemory
250765dvdg6566Ispit (COCI19_ispit)C++14
90 / 90
1628 ms1284 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...