Submission #494827

#TimeUsernameProblemLanguageResultExecution timeMemory
494827niloyrootIspit (COCI19_ispit)C++14
90 / 90
10 ms912 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<ll>; using pl = pair<ll,ll>; #define pb push_back #define form(m,it) for(auto it=m.begin(); it!=m.end(); it++) #define forp(i,a,b) for(ll i=a; i<=b; i++) #define forn(i,a,b) for(ll i=a; i>=b; i--) #define newl '\n' #define ff first #define ss second const ll mod = 1e9 + 7; void solve(){ ll n,k; cin>>n>>k; char a[n+1][n+1]; forp(i,1,n){ forp(j,1,n){ cin>>a[i][j]; } } ll cnt[26][n+1]; memset(cnt,0,sizeof(cnt)); forp(i,1,n){ forp(j,1,n){ cnt[a[i][j]-'a'][i]++; } } ll start,end; bool g; forp(i,1,n){ forp(j,i+1,n){ // i and j are two columns u wanna check are possible to make equal or not start=0; end=0; forp(l,1,n){ if(a[i][l]!=a[j][l]){ start=l; break; } } forn(l,n,1){ if(a[i][l]!=a[j][l]){ end=l; break; } } g=1; forp(l,0,25){ if(cnt[l][i]!=cnt[l][j]){ g=0; } } if(end-start+1<=k && g){ cout<<"DA"<<newl; return; } } } cout<<"NE"<<newl; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t=1; //cin>>t; while(t--)solve(); }
#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...