# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
661322 | 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];
set<string> s;
map<string, int> mp
for(int i = 0; i < n; i++){
cin >> a[i];
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);
}
}
}
int ans = 0;
for(string ss : s) m[ss]++;
for(string ss : m) ans += m[ss]++;
cout << ans - n << '\n';
}