# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
315208 | 2020-10-22T04:41:45 Z | Kesatria_Komodo | Lozinke (COCI17_lozinke) | C++17 | 312 ms | 15548 KB |
#include <iostream> #include <unordered_map> using namespace std; int main(){ int N , ans = 0; unordered_map<string , int> mp; cin >> N; string arr[N]; for (int i = 0 ; i < N ; i++) cin >> arr[i] , ++mp[arr[i]]; for (int i = 0 ; i < N ; i++){ unordered_map<string , bool> computed; for (int k = 0 ; k < arr[i].size() ; k++){ string now = ""; for (int l = k ; l < arr[i].size() ; l++){ now.push_back(arr[i][l]); bool &it = computed[now]; if (it) continue; it = 1 , ans += mp[now]; } } } cout << ans - N << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 7 ms | 768 KB | Output is correct |
6 | Correct | 11 ms | 768 KB | Output is correct |
7 | Correct | 15 ms | 1408 KB | Output is correct |
8 | Correct | 21 ms | 2176 KB | Output is correct |
9 | Correct | 58 ms | 2424 KB | Output is correct |
10 | Correct | 127 ms | 7324 KB | Output is correct |
11 | Correct | 92 ms | 4100 KB | Output is correct |
12 | Correct | 294 ms | 15548 KB | Output is correct |
13 | Correct | 160 ms | 2808 KB | Output is correct |
14 | Correct | 223 ms | 14216 KB | Output is correct |
15 | Correct | 312 ms | 15420 KB | Output is correct |
16 | Correct | 159 ms | 1280 KB | Output is correct |
17 | Correct | 85 ms | 1128 KB | Output is correct |
18 | Correct | 62 ms | 1152 KB | Output is correct |
19 | Correct | 188 ms | 8220 KB | Output is correct |
20 | Correct | 90 ms | 1280 KB | Output is correct |