Submission #96660

#TimeUsernameProblemLanguageResultExecution timeMemory
96660noneTPIspit (COCI19_ispit)C++14
90 / 90
472 ms640 KiB
#include <bits/stdc++.h> using namespace std; typedef tuple<int, int, int> tp; typedef long long LL; typedef long double LD; typedef pair<int, int> pii; typedef pair<int, LL> pil; typedef pair<LL, int> pli; typedef pair<LL, LL> pll; typedef pair<pii, int> piipi; typedef pair<int, pii> pipii; typedef pair<pii, pii> piipii; typedef pair<LL, pii> plpii; typedef pair<LD, LD> pdd; typedef pair<LD, int> pdi; typedef pair<LD, LL> pdl; typedef pair<int, LD> pid; typedef pair<LL, LD> pld; const int mod = 1e9 + 7; const int hf = 999983; const int N = 1e6; char s[555][555]; int fi[555], se[555]; int hv[555]; int cnt[555]; int main(){ hv[0] = 1; for(int i=1;i<=555-1;i++) hv[i] = (hv[i-1]*1ll*hf)%mod; int n, k; scanf("%d%d", &n, &k); bool ok = 0; for(int i=1;i<=n;i++) scanf("%s", s[i]+1); for(int l=1;l<=n-k+1;l++){ int r = l+k-1; memset(fi, 0, sizeof(fi)); memset(se, 0, sizeof(se)); for(int i=1;i<=n;i++){ for(int j=1;j<=l-1;j++) fi[i] = (fi[i] + hv[j]*1ll*s[i][j])%mod; for(int j=r+1;j<=n;j++) fi[i] = (fi[i] + hv[j]*1ll*s[i][j])%mod; memset(cnt, 0, sizeof(cnt)); for(int j=l;j<=r;j++) cnt[s[i][j]-'a']++; for(int j=0;j<26;j++) se[i] = (se[i] + hv[j]*1ll*cnt[j])%mod; } for(int i=1;i<=n;i++){ for(int j=i+1;j<=n;j++){ if(fi[i] == fi[j] && se[i] == se[j]) ok = 1; } } } if(ok) printf("DA\n"); else printf("NE\n"); }

Compilation message (stderr)

ispit.cpp: In function 'int main()':
ispit.cpp:31:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &k);
     ~~~~~^~~~~~~~~~~~~~~~
ispit.cpp:33:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=1;i<=n;i++) scanf("%s", s[i]+1);
                           ~~~~~^~~~~~~~~~~~~~
#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...