// This code is written by _L__
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<class T> using ordered_set = tree<T, null_type , less<T> , rb_tree_tag , tree_order_statistics_node_update>;
#define endl '\n'
#define F_word ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
typedef long long ll;
typedef long double ld;
const ll mod = 1e9+7, N = 1e5+300, inf = 1e18;
const ld E = 1e-6;
#define ff first
#define ss second
int main(void){
F_word;
int n; cin >> n;
string arr[n]; for(int i = 0; i < n; ++i) cin >> arr[i];
ll ans = 0;
for(int i = 0; i < n; ++i){
for(int j = 0; j < n; ++j){
if(i == j) continue;
if(arr[j].find(arr[i]) != string::npos)++ans;
}
}
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
4 ms |
204 KB |
Output is correct |
5 |
Correct |
19 ms |
332 KB |
Output is correct |
6 |
Correct |
47 ms |
332 KB |
Output is correct |
7 |
Correct |
71 ms |
332 KB |
Output is correct |
8 |
Correct |
55 ms |
332 KB |
Output is correct |
9 |
Execution timed out |
1069 ms |
588 KB |
Time limit exceeded |
10 |
Execution timed out |
1063 ms |
596 KB |
Time limit exceeded |
11 |
Execution timed out |
1080 ms |
716 KB |
Time limit exceeded |
12 |
Execution timed out |
1079 ms |
716 KB |
Time limit exceeded |
13 |
Execution timed out |
1090 ms |
844 KB |
Time limit exceeded |
14 |
Execution timed out |
1078 ms |
844 KB |
Time limit exceeded |
15 |
Execution timed out |
1057 ms |
844 KB |
Time limit exceeded |
16 |
Execution timed out |
1064 ms |
844 KB |
Time limit exceeded |
17 |
Execution timed out |
1074 ms |
844 KB |
Time limit exceeded |
18 |
Execution timed out |
1045 ms |
844 KB |
Time limit exceeded |
19 |
Execution timed out |
1074 ms |
844 KB |
Time limit exceeded |
20 |
Execution timed out |
1083 ms |
844 KB |
Time limit exceeded |