# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95384 | 2019-01-31T07:52:36 Z | teomrn | Lozinke (COCI17_lozinke) | C++14 | 554 ms | 16552 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 380 KB | Output is correct |
5 | Correct | 11 ms | 732 KB | Output is correct |
6 | Correct | 19 ms | 760 KB | Output is correct |
7 | Correct | 24 ms | 1528 KB | Output is correct |
8 | Correct | 40 ms | 2296 KB | Output is correct |
9 | Correct | 102 ms | 2424 KB | Output is correct |
10 | Correct | 230 ms | 7516 KB | Output is correct |
11 | Correct | 167 ms | 4216 KB | Output is correct |
12 | Correct | 463 ms | 16552 KB | Output is correct |
13 | Correct | 318 ms | 2680 KB | Output is correct |
14 | Correct | 347 ms | 14968 KB | Output is correct |
15 | Correct | 554 ms | 16304 KB | Output is correct |
16 | Correct | 305 ms | 1272 KB | Output is correct |
17 | Correct | 54 ms | 1164 KB | Output is correct |
18 | Correct | 41 ms | 1016 KB | Output is correct |
19 | Correct | 359 ms | 8568 KB | Output is correct |
20 | Correct | 147 ms | 1272 KB | Output is correct |