#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define sz(x) int(x.size())
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
#define N 100500
#define oo ll(1e16)
#define ft first
#define sd second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define el '\n'
#define elf endl
#define base ll(1e9 + 7)
using namespace std;
typedef long long ll;
typedef long double ld;
int n, ans;
string s[N];
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n;
for (int i = 0; i < n; i++)
cin >> s[i];
sort(s, s + n);
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
if (i != j && int(s[j].find(s[i])) != -1)
ans++;
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
9 ms |
3456 KB |
Output is correct |
5 |
Correct |
24 ms |
3456 KB |
Output is correct |
6 |
Correct |
53 ms |
3456 KB |
Output is correct |
7 |
Correct |
71 ms |
3456 KB |
Output is correct |
8 |
Correct |
56 ms |
3456 KB |
Output is correct |
9 |
Execution timed out |
1099 ms |
3456 KB |
Time limit exceeded |
10 |
Execution timed out |
1084 ms |
3456 KB |
Time limit exceeded |
11 |
Execution timed out |
1099 ms |
3456 KB |
Time limit exceeded |
12 |
Execution timed out |
1088 ms |
3456 KB |
Time limit exceeded |
13 |
Execution timed out |
1093 ms |
3456 KB |
Time limit exceeded |
14 |
Execution timed out |
1095 ms |
3456 KB |
Time limit exceeded |
15 |
Execution timed out |
1095 ms |
3456 KB |
Time limit exceeded |
16 |
Execution timed out |
1095 ms |
3456 KB |
Time limit exceeded |
17 |
Execution timed out |
1095 ms |
3456 KB |
Time limit exceeded |
18 |
Execution timed out |
1096 ms |
3456 KB |
Time limit exceeded |
19 |
Execution timed out |
1100 ms |
3456 KB |
Time limit exceeded |
20 |
Execution timed out |
1094 ms |
3456 KB |
Time limit exceeded |