# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
98894 | Ort | Lozinke (COCI17_lozinke) | C++11 | 469 ms | 15212 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<iostream>
#include<string>
#include<vector>
#include<unordered_map>
#include<unordered_set>
using namespace std;
unordered_map<string,int> um;
unordered_set<string> us;
vector<string> vs;
int n;
string s;
int sol = 0;
int main() {
cin >> n;
for(int i=0;i<n;i++) {
us.clear();
cin >> s;
vs.push_back(s);
for(int j=0;j<s.size();j++)
for(int k=1;k<=s.size()-j;k++)
if(us.find(s.substr(j,k))==us.end()) {
um[s.substr(j,k)] += 1;
us.insert(s.substr(j,k));
}
}
for(int i=0;i<vs.size();i++) sol += (um[vs[i]] - 1);
cout << sol;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |