# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
928998 | NourWael | Lozinke (COCI17_lozinke) | C++17 | 356 ms | 16720 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 int long long
using namespace std;
map<string,int> mp;
string a[20005];
signed main() {
int n; cin>>n;
for(int i=0; i<n; i++){
string s; cin>>s;
a[i] = s;
mp[s]++;
}
int ans = 0;
for(int i=0; i<n; i++){
string s = a[i];
set<string> st;
for(int j=0; j<s.size(); j++){
string t = "";
for(int k=j; k<s.size(); k++) {
t+=s[k];
if(st.find(t)==st.end()) ans += mp[t];
st.insert(t);
}
}
ans--;
}
cout<<ans;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |