Submission #104521

#TimeUsernameProblemLanguageResultExecution timeMemory
104521HassoonyIspit (COCI19_ispit)C++17
90 / 90
226 ms896 KiB
#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)

ispit.cpp: In function 'int main()':
ispit.cpp:12:41: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'char (*)[502]' [-Wformat=]
     for(int i=0;i<n;i++)scanf("%s",&a[i]);
                                    ~~~~~^
ispit.cpp:21:30: warning: array subscript has type 'char' [-Wchar-subscripts]
                     c[a[i][k]]++;
                              ^
ispit.cpp:28:33: warning: array subscript has type 'char' [-Wchar-subscripts]
                     if(c[a[j][k]])c[a[j][k]]--;
                                 ^
ispit.cpp:28:44: warning: array subscript has type 'char' [-Wchar-subscripts]
                     if(c[a[j][k]])c[a[j][k]]--;
                                            ^
ispit.cpp:12:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<n;i++)scanf("%s",&a[i]);
                         ~~~~~^~~~~~~~~~~~
#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...