# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
231997 | 2020-05-15T15:34:30 Z | DodgeBallMan | Lozinke (COCI17_lozinke) | C++14 | 514 ms | 16888 KB |
#include <bits/stdc++.h> using namespace std; const int N = 2e4 + 10; map<string, int> ma; int n; string s[N]; int main() { scanf("%d",&n); for( int i = 1 ; i <= n ; i++ ) cin >> s[i], ++ma[s[i]]; int ans = 0; for( int i = 1 ; i <= n ; i++ ) { vector<string > v; int l = s[i].size(); for( int leng = 1 ; leng <= l ; leng++ ) { for( int j = 0 ; j + leng - 1 < l ; j++ ) { string k = s[i].substr( j, leng ); v.push_back( k ); } } sort( v.begin(), v.end() ); v.resize( unique( v.begin(), v.end() )-v.begin() ); for( string k : v ) ans += ma[k]; } printf("%d",ans-n); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 896 KB | Output is correct |
2 | Correct | 5 ms | 896 KB | Output is correct |
3 | Correct | 6 ms | 1024 KB | Output is correct |
4 | Correct | 6 ms | 1024 KB | Output is correct |
5 | Correct | 16 ms | 1408 KB | Output is correct |
6 | Correct | 25 ms | 1280 KB | Output is correct |
7 | Correct | 30 ms | 2048 KB | Output is correct |
8 | Correct | 46 ms | 2936 KB | Output is correct |
9 | Correct | 122 ms | 2808 KB | Output is correct |
10 | Correct | 220 ms | 7928 KB | Output is correct |
11 | Correct | 185 ms | 4472 KB | Output is correct |
12 | Correct | 493 ms | 16888 KB | Output is correct |
13 | Correct | 358 ms | 2808 KB | Output is correct |
14 | Correct | 356 ms | 15224 KB | Output is correct |
15 | Correct | 514 ms | 16752 KB | Output is correct |
16 | Correct | 388 ms | 1400 KB | Output is correct |
17 | Correct | 151 ms | 1152 KB | Output is correct |
18 | Correct | 110 ms | 1152 KB | Output is correct |
19 | Correct | 352 ms | 8792 KB | Output is correct |
20 | Correct | 195 ms | 1280 KB | Output is correct |