# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
469524 | 2021-09-01T08:47:53 Z | Karabasan | Lozinke (COCI17_lozinke) | C++17 | 399 ms | 16600 KB |
#include <bits/stdc++.h> #define N 20005 using namespace std; map<string,int> mp; string s[N]; void solve(){ int n; cin >> n; int ans = 0; for(int i=0;i<n;i++){ cin >> s[i]; mp[s[i]]++; } for(int i=0;i<n;i++){ set<string> st; for(int j=0;j<s[i].size();j++){ string tmp = ""; for(int c = j;c<s[i].size();c++){ tmp += s[i][c]; st.insert(tmp); } } for(auto u:st){ ans += mp[u]; } } cout << ans-n; } int main() { solve(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 844 KB | Output is correct |
2 | Correct | 1 ms | 844 KB | Output is correct |
3 | Correct | 1 ms | 844 KB | Output is correct |
4 | Correct | 2 ms | 916 KB | Output is correct |
5 | Correct | 9 ms | 1228 KB | Output is correct |
6 | Correct | 15 ms | 1228 KB | Output is correct |
7 | Correct | 19 ms | 1932 KB | Output is correct |
8 | Correct | 32 ms | 2756 KB | Output is correct |
9 | Correct | 82 ms | 2668 KB | Output is correct |
10 | Correct | 174 ms | 7692 KB | Output is correct |
11 | Correct | 140 ms | 4356 KB | Output is correct |
12 | Correct | 399 ms | 16600 KB | Output is correct |
13 | Correct | 260 ms | 2628 KB | Output is correct |
14 | Correct | 277 ms | 14852 KB | Output is correct |
15 | Correct | 392 ms | 16196 KB | Output is correct |
16 | Correct | 274 ms | 1092 KB | Output is correct |
17 | Correct | 67 ms | 896 KB | Output is correct |
18 | Correct | 64 ms | 844 KB | Output is correct |
19 | Correct | 271 ms | 8468 KB | Output is correct |
20 | Correct | 131 ms | 1044 KB | Output is correct |