# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
280465 | Revo7 | Lozinke (COCI17_lozinke) | C++14 | 272 ms | 15692 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define left 2*i+1
#define righ 2*i+2
#define mid (l+r)/2
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const ll maxn=2e4+100;
const ll mod=1e9+9;
const ll base=27;
ll n;
string s[maxn];
unordered_map<string,ll>cnt;
ll ans=0;
unordered_map<string,bool>vis;
void solve(ll i){
vis.clear();
for(ll l=0;l<s[i].size();l++){
string t="";
for(ll r=l;r<s[i].size();r++){
t.pb(s[i][r]);
if(!vis[t]){
ans+=cnt[t];
vis[t]=1;
}
}
}
ans--;
}
int main()
{
//setIO("threesum");
IOS
cin>>n;
for(ll i=0;i<n;i++)cin>>s[i];
for(ll i=0;i<n;i++){
cnt[s[i]]++;
}
for(ll i=0;i<n;i++)solve(i);
cout<<ans<<endl;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |