# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
928998 | 2024-02-17T12:41:32 Z | NourWael | Lozinke (COCI17_lozinke) | C++17 | 356 ms | 16720 KB |
#include <bits/stdc++.h> #define int long long using namespace std; map<string,int> mp; string a[20005]; signed main() { int n; cin>>n; for(int i=0; i<n; i++){ string s; cin>>s; a[i] = s; mp[s]++; } int ans = 0; for(int i=0; i<n; i++){ string s = a[i]; set<string> st; for(int j=0; j<s.size(); j++){ string t = ""; for(int k=j; k<s.size(); k++) { t+=s[k]; if(st.find(t)==st.end()) ans += mp[t]; st.insert(t); } } ans--; } cout<<ans; 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 | 860 KB | Output is correct |
4 | Correct | 1 ms | 1116 KB | Output is correct |
5 | Correct | 8 ms | 1372 KB | Output is correct |
6 | Correct | 12 ms | 1324 KB | Output is correct |
7 | Correct | 16 ms | 2136 KB | Output is correct |
8 | Correct | 27 ms | 2896 KB | Output is correct |
9 | Correct | 64 ms | 2660 KB | Output is correct |
10 | Correct | 132 ms | 7780 KB | Output is correct |
11 | Correct | 113 ms | 4468 KB | Output is correct |
12 | Correct | 279 ms | 16720 KB | Output is correct |
13 | Correct | 209 ms | 2892 KB | Output is correct |
14 | Correct | 208 ms | 15320 KB | Output is correct |
15 | Correct | 356 ms | 16500 KB | Output is correct |
16 | Correct | 215 ms | 1372 KB | Output is correct |
17 | Correct | 76 ms | 1364 KB | Output is correct |
18 | Correct | 47 ms | 1116 KB | Output is correct |
19 | Correct | 206 ms | 8724 KB | Output is correct |
20 | Correct | 108 ms | 1112 KB | Output is correct |