# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
240034 | marlicu | Lozinke (COCI17_lozinke) | C++14 | 497 ms | 16632 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 n;
map <string, int> podniz;
vector <string> s;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> n;
s.resize(n);
for (int i = 0; i < n; i++) {
cin >> s[i];
}
for (auto x : s) {
set <string> ss;
for (unsigned i = 0; i < x.size(); i++) {
for (unsigned j = i; j < x.size(); j++) {
ss.insert(x.substr(i, x.size() - j));
}
}
for (auto xx : ss) {
podniz[xx]++;
}
}
/*
for (auto x : podniz) {
cout << x.first << " " << x.second << '\n';
}
*/
int koliko = 0;
for (auto x : s) {
koliko += podniz[x];
}
cout << koliko - n;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |