#include <bits/stdc++.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
using namespace std;
typedef long long ll;
#define FOR(i, l, r) for(ll i = l; i <= r; i++)
ll num = 0;
int main(){
string a[2005];
ll n; cin >> n;
FOR(i, 1, n){
cin >> a[i];
}
FOR(i, 1, n){
FOR(j, 1, i - 1){
size_t found = a[i].find(a[j]);
if(found != string::npos) num++;
size_t found1 = a[j].find(a[i]);
if(found1 != string::npos) num++;
}
}
cout << num;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
23 ms |
384 KB |
Output is correct |
6 |
Correct |
51 ms |
384 KB |
Output is correct |
7 |
Correct |
65 ms |
384 KB |
Output is correct |
8 |
Correct |
50 ms |
384 KB |
Output is correct |
9 |
Runtime error |
3 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
10 |
Runtime error |
3 ms |
648 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
11 |
Runtime error |
3 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Runtime error |
3 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
13 |
Runtime error |
4 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
14 |
Runtime error |
3 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
15 |
Runtime error |
3 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
16 |
Runtime error |
3 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
17 |
Runtime error |
3 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
18 |
Runtime error |
3 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
19 |
Runtime error |
3 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
20 |
Runtime error |
3 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |