# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95384 | teomrn | Lozinke (COCI17_lozinke) | C++14 | 554 ms | 16552 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;
void solve()
{
map <string, int> Hash, act;
int n;
cin >> n;
long long ans = -n;
vector <string> v(n);
for (auto & i: v) {
cin >> i;
Hash[i]++;
}
for (auto s : v) {
act.clear();
for (int beg = 0; beg < s.size(); beg++) {
string q = "";
for (int i = beg; i < s.size(); i++) {
q += s[i];
if (act.find(q) == act.end()) {
act[q] = 1;
ans += Hash[q];
}
}
}
}
cout << ans << '\n';
}
int main()
{
solve();
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |