Submission #170361

#TimeUsernameProblemLanguageResultExecution timeMemory
170361mdn2002Lozinke (COCI17_lozinke)C++14
75 / 100
1091 ms61776 KiB
#include<bits/stdc++.h> using namespace std; const long long mod=998244353; int n,ans; map<string,int>mp; map<pair<string,int>,int>m; vector<string>v; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); //freopen("lemonade.in","r",stdin); //freopen("lemonade.out","w",stdout); cin>>n; for(int i=0;i<n;i++) { string s; cin>>s; v.push_back(s); mp[s]++; } for(int i=0;i<n;i++) { for(int j=0;j<v[i].size();j++) { string s; for(int z=j;z<v[i].size();z++) { s.push_back(v[i][z]); if(m[{s,i}]==0) { ans+=mp[s]; m[{s,i}]++; } } } } cout<<ans-n; }

Compilation message (stderr)

lozinke.cpp: In function 'int main()':
lozinke.cpp:25:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=0;j<v[i].size();j++)
                     ~^~~~~~~~~~~~
lozinke.cpp:28:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int z=j;z<v[i].size();z++)
                         ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...