Submission #116838

#TimeUsernameProblemLanguageResultExecution timeMemory
116838hungcungLozinke (COCI17_lozinke)C++14
100 / 100
270 ms15288 KiB
#include<bits/stdc++.h> using namespace std; int n; string l[20014]; unordered_set<string> s; unordered_map<string, int> cnt; int main(void) { cin >> n; for (int i = 0; i < n; ++i) { cin >> l[i]; s.clear(); for (int j = 0; j < (int) l[i].size(); ++j) { string a; for (int k = j; k < (int) l[i].size(); ++k) { a.push_back(l[i][k]); s.insert(a); } } for (auto &x : s) cnt[x]++; } int sol = 0; for (auto &x : l) sol += cnt[x]; cout << sol - n << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...