#include <bits/stdc++.h>
using namespace std;
string s[20002];
int main(int argc, char *argv[]) {
ios_base::sync_with_stdio(false);
int n;
cin>>n;
int res = 0;
for(int i=0;i<n;i++) cin>>s[i];
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
if(i!=j&&s[i].find(s[j])!=string::npos){
res++;
}
cout<<res<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1072 KB |
Output is correct |
2 |
Correct |
3 ms |
896 KB |
Output is correct |
3 |
Correct |
3 ms |
896 KB |
Output is correct |
4 |
Correct |
6 ms |
1024 KB |
Output is correct |
5 |
Correct |
19 ms |
896 KB |
Output is correct |
6 |
Correct |
47 ms |
1004 KB |
Output is correct |
7 |
Correct |
61 ms |
896 KB |
Output is correct |
8 |
Correct |
44 ms |
1024 KB |
Output is correct |
9 |
Execution timed out |
1075 ms |
1024 KB |
Time limit exceeded |
10 |
Execution timed out |
1069 ms |
896 KB |
Time limit exceeded |
11 |
Execution timed out |
1073 ms |
896 KB |
Time limit exceeded |
12 |
Execution timed out |
1070 ms |
896 KB |
Time limit exceeded |
13 |
Execution timed out |
1072 ms |
896 KB |
Time limit exceeded |
14 |
Execution timed out |
1086 ms |
896 KB |
Time limit exceeded |
15 |
Execution timed out |
1074 ms |
896 KB |
Time limit exceeded |
16 |
Execution timed out |
1086 ms |
896 KB |
Time limit exceeded |
17 |
Execution timed out |
1067 ms |
1024 KB |
Time limit exceeded |
18 |
Execution timed out |
1076 ms |
896 KB |
Time limit exceeded |
19 |
Execution timed out |
1063 ms |
896 KB |
Time limit exceeded |
20 |
Execution timed out |
1058 ms |
1024 KB |
Time limit exceeded |