# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
245908 |
2020-07-07T18:08:27 Z |
alrad |
Lozinke (COCI17_lozinke) |
C++17 |
|
287 ms |
15676 KB |
#include <bits/stdc++.h>
using namespace std;
#define N (int)1e9 + 1
#define all(x) x.begin(), x.end()
int main() {
#ifdef judge
ifstream cin("input.txt");
//ofstream cout("output.txt");
#endif // judge
ios_base :: sync_with_stdio(0);
cin.tie(0) , cout.tie(0);
int n;
cin >> n;
vector<string> a(n);
unordered_map<string , int> sub;
for (int i = 0; i < n; i++) {
cin >> a[i];
unordered_map<string , bool> used;
for (int l = 0; l < (int)a[i].size(); l++) {
string cur = "";
for (int r = l; r < (int)a[i].size(); r++) {
cur += a[i][r];
if (!used[cur]) {
sub[cur]++;
used[cur] = true;
}
}
}
}
int ans = 0;
for (int i = 0; i < n; i++) {
ans += (sub[a[i]] - 1);
}
cout << ans << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
10 ms |
768 KB |
Output is correct |
6 |
Correct |
15 ms |
768 KB |
Output is correct |
7 |
Correct |
18 ms |
1536 KB |
Output is correct |
8 |
Correct |
24 ms |
2176 KB |
Output is correct |
9 |
Correct |
59 ms |
2424 KB |
Output is correct |
10 |
Correct |
119 ms |
7304 KB |
Output is correct |
11 |
Correct |
101 ms |
4248 KB |
Output is correct |
12 |
Correct |
287 ms |
15676 KB |
Output is correct |
13 |
Correct |
206 ms |
2808 KB |
Output is correct |
14 |
Correct |
184 ms |
14396 KB |
Output is correct |
15 |
Correct |
266 ms |
15548 KB |
Output is correct |
16 |
Correct |
178 ms |
1280 KB |
Output is correct |
17 |
Correct |
81 ms |
1152 KB |
Output is correct |
18 |
Correct |
61 ms |
1152 KB |
Output is correct |
19 |
Correct |
188 ms |
8304 KB |
Output is correct |
20 |
Correct |
103 ms |
1280 KB |
Output is correct |