# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
661327 | Trisanu_Das | Lozinke (COCI17_lozinke) | C++17 | 0 ms | 0 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>
using namespace std;
int main(){
int n; cin >> n;
string a[n];
unordered_set<string> s;
unordered_map<string, int> m;
for(int i = 0;i < n; i++){
cin >> a[i];
s.clear();
for(int j = 0;j < a[i].size(); j++){
string ss;
for(int k = j; k < a[i].size(); k++){
ss += a[i][k]; s.insert(ss);
}
}
for(auto &x : s) m[x]++;
}
int ans = 0;
for(auto &x:l) ans += m[x];
cout << ans - n << '\n';
}