# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
914711 | racsosabe | Lozinke (COCI17_lozinke) | C++14 | 287 ms | 16728 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;
const int N = 20000 + 5;
int n;
string s[N];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n;
map<string, int> frec;
for(int i = 1; i <= n; i++) {
cin >> s[i];
frec[s[i]] += 1;
}
long long res = 0;
for(int id = 1; id <= n; id++) {
set<string> used;
for(int i = 0; i < s[id].size(); i++) {
string cur = "";
for(int j = i; j < s[id].size(); j++) {
cur.push_back(s[id][j]);
if(!used.count(cur)) {
used.emplace(cur);
res += frec[cur];
}
}
}
res -= 1;
}
cout << res << endl;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |