Submission #80283

#TimeUsernameProblemLanguageResultExecution timeMemory
80283GenezioLozinke (COCI17_lozinke)C++14
10 / 100
1016 ms66560 KiB
#include<bits/stdc++.h> using namespace std; #define pii pair<int,int> #define mp make_pair #define F first #define S second #define pb push_back #define ll long long const int N = 100010; const int INF = 0x3f3f3f3f; const ll mod = 1e9+7; string s; map< string,set<int> > m; map< string,set<int> > subs; map< string,set<int> > f; string x; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin>>n; int ans=0; for(int i=0;i<n;i++) { cin>>s; ans+=subs[s].size(); //ans+=f[s].size(); //cout<<i<<" "<<ans<<"\n"; //f[s].insert(i); for(int k=0;k<s.size();k++) { string p=x; for(int j=k;j<s.size();j++) { p+=s[j]; ans+=m[p].size(); //if(k==0&&j==s.size()-1) continue; subs[p].insert(i); //ans+=f[p].size(); //cout<<i<<" "<<k<<" "<<j<<" "<<ans<<"\n"; } } m[s].insert(i); } cout<<ans<<"\n"; return 0; }

Compilation message (stderr)

lozinke.cpp: In function 'int main()':
lozinke.cpp:34:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int k=0;k<s.size();k++) {
                     ~^~~~~~~~~
lozinke.cpp:36:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          for(int j=k;j<s.size();j++) {
                      ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...