Submission #929072

#TimeUsernameProblemLanguageResultExecution timeMemory
929072sondos225Lozinke (COCI17_lozinke)C++17
25 / 100
175 ms16720 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL); #define pb push_back #define yes "YES" #define no "NO" #define bigg INT_MAX #define debug(x) cout<<(#x)<<" = " <<x<<endl; #define all(x) x.begin(),x.end() #define sz size() #define nn '\n' #define mms(x,y) memset(x,y,sizeof(x)) #define forr(i,j,n) for (int i=j; i<n; i++) #define forn(i,j,n) for (int i=j; i>n; i--) #define fi first #define se second #define la "LA" #define cinn(x,y) for(int i=0; i<y; i++) cin>>x[i]; #define pii pair<int,int> signed main() { // #ifndef LOCAL // freopen("helpcross.in","r",stdin); // freopen("helpcross.out","w", stdout); // #endif fast int n; cin>>n; string a[n]; map<string,int> m; forr(i,0,n) { cin>>a[i]; m[a[i]]++; } int ans=0; forr(k,0,n) { string s=a[k]; int w=s.sz; forr(j,0,w) { string cur=""; forr(i,j,w) { cur+=s[i]; ans+=m[cur]; } // cout<<k<<' '<<cur<<endl; } } cout<<ans-n; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...