# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
42292 | 2018-02-25T13:24:23 Z | milmillin | Lozinke (COCI17_lozinke) | C++14 | 520 ms | 18040 KB |
#include <cstdio> #include <set> #include <vector> #include <string> #include <map> #include <iostream> using namespace std; map<string,int> mp; vector<string> inp; int main () { int n; scanf("%d",&n); string x; for (int i=0;i<n;i++) { cin>>x; inp.push_back(x); //printf("%d\n",x.length()); set<string> st; for (int j=0;j<(int)x.length();j++) { for (int k=j;k<(int)x.length();k++) { //printf("-- %d\n",j); st.insert(x.substr(j,k-j+1)); //mp[x.substr(j,k-j+1)]++; } } for (auto &a:st) { mp[a]++; } } int cnt=0; for (auto &a: inp) { cnt+=mp[a]-1; //printf("%d\n",mp[a]); } printf("%d\n",cnt); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 484 KB | Output is correct |
4 | Correct | 3 ms | 528 KB | Output is correct |
5 | Correct | 11 ms | 1088 KB | Output is correct |
6 | Correct | 19 ms | 1088 KB | Output is correct |
7 | Correct | 25 ms | 1868 KB | Output is correct |
8 | Correct | 38 ms | 2668 KB | Output is correct |
9 | Correct | 108 ms | 2956 KB | Output is correct |
10 | Correct | 222 ms | 8140 KB | Output is correct |
11 | Correct | 175 ms | 8140 KB | Output is correct |
12 | Correct | 517 ms | 17416 KB | Output is correct |
13 | Correct | 309 ms | 17416 KB | Output is correct |
14 | Correct | 370 ms | 17416 KB | Output is correct |
15 | Correct | 520 ms | 18040 KB | Output is correct |
16 | Correct | 290 ms | 18040 KB | Output is correct |
17 | Correct | 88 ms | 18040 KB | Output is correct |
18 | Correct | 65 ms | 18040 KB | Output is correct |
19 | Correct | 365 ms | 18040 KB | Output is correct |
20 | Correct | 166 ms | 18040 KB | Output is correct |