# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
237196 |
2020-06-05T08:29:10 Z |
Mlxa |
Lozinke (COCI17_lozinke) |
C++14 |
|
486 ms |
19240 KB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define all(x) x.begin(), x.end()
#define x first
#define y second
#define mp make_pair
#define mt make_tuple
const int N = 1e5;
map<string, int> cnt;
int n;
string str[N];
signed main() {
#ifdef LC
assert(freopen("input.txt", "r", stdin));
#endif
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
str[i] = s;
set<string> cur;
for (int l = 0; l < (int)s.size(); ++l) {
for (int k = 1; k <= (int)s.size() - l; ++k) {
cur.insert(s.substr(l, k));
}
}
for (auto e : cur) {
++cnt[e];
}
}
int answer = 0;
for (int i = 0; i < n; ++i) {
answer += cnt[str[i]] - 1;
}
cout << answer << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
3456 KB |
Output is correct |
2 |
Correct |
6 ms |
3456 KB |
Output is correct |
3 |
Correct |
7 ms |
3456 KB |
Output is correct |
4 |
Correct |
7 ms |
3584 KB |
Output is correct |
5 |
Correct |
17 ms |
3840 KB |
Output is correct |
6 |
Correct |
23 ms |
3840 KB |
Output is correct |
7 |
Correct |
28 ms |
4608 KB |
Output is correct |
8 |
Correct |
41 ms |
5376 KB |
Output is correct |
9 |
Correct |
99 ms |
5324 KB |
Output is correct |
10 |
Correct |
215 ms |
10616 KB |
Output is correct |
11 |
Correct |
160 ms |
7032 KB |
Output is correct |
12 |
Correct |
451 ms |
19240 KB |
Output is correct |
13 |
Correct |
292 ms |
5496 KB |
Output is correct |
14 |
Correct |
309 ms |
17588 KB |
Output is correct |
15 |
Correct |
486 ms |
19172 KB |
Output is correct |
16 |
Correct |
296 ms |
3960 KB |
Output is correct |
17 |
Correct |
84 ms |
3712 KB |
Output is correct |
18 |
Correct |
64 ms |
3712 KB |
Output is correct |
19 |
Correct |
330 ms |
11204 KB |
Output is correct |
20 |
Correct |
150 ms |
3712 KB |
Output is correct |