# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
914711 | 2024-01-22T15:03:28 Z | racsosabe | Lozinke (COCI17_lozinke) | C++14 | 287 ms | 16728 KB |
#include<bits/stdc++.h> using namespace::std; const int N = 20000 + 5; int n; string s[N]; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; map<string, int> frec; for(int i = 1; i <= n; i++) { cin >> s[i]; frec[s[i]] += 1; } long long res = 0; for(int id = 1; id <= n; id++) { set<string> used; for(int i = 0; i < s[id].size(); i++) { string cur = ""; for(int j = i; j < s[id].size(); j++) { cur.push_back(s[id][j]); if(!used.count(cur)) { used.emplace(cur); res += frec[cur]; } } } res -= 1; } cout << res << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 860 KB | Output is correct |
2 | Correct | 1 ms | 860 KB | Output is correct |
3 | Correct | 1 ms | 1116 KB | Output is correct |
4 | Correct | 1 ms | 1116 KB | Output is correct |
5 | Correct | 7 ms | 1372 KB | Output is correct |
6 | Correct | 12 ms | 1384 KB | Output is correct |
7 | Correct | 15 ms | 2140 KB | Output is correct |
8 | Correct | 24 ms | 3028 KB | Output is correct |
9 | Correct | 60 ms | 2900 KB | Output is correct |
10 | Correct | 122 ms | 7764 KB | Output is correct |
11 | Correct | 97 ms | 4432 KB | Output is correct |
12 | Correct | 268 ms | 16728 KB | Output is correct |
13 | Correct | 184 ms | 2896 KB | Output is correct |
14 | Correct | 185 ms | 14932 KB | Output is correct |
15 | Correct | 287 ms | 16584 KB | Output is correct |
16 | Correct | 194 ms | 1368 KB | Output is correct |
17 | Correct | 39 ms | 1568 KB | Output is correct |
18 | Correct | 29 ms | 1364 KB | Output is correct |
19 | Correct | 188 ms | 8788 KB | Output is correct |
20 | Correct | 93 ms | 1372 KB | Output is correct |