Submission #240034

#TimeUsernameProblemLanguageResultExecution timeMemory
240034marlicuLozinke (COCI17_lozinke)C++14
100 / 100
497 ms16632 KiB
#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 timeMemoryGrader output
Fetching results...