#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
#define nn "\n"
#define x_x ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define intt int _; cin >> _; while (_--)
#define emp push_back
#define mod 1000000007
#define all(v) v.begin(), v.end()
#define ld long double
#define A first
#define B second
typedef long long ll;
const ld eps = 1e-27;
// diff between decimals 0.000000001 mt19937 mt(time(nullptr));
int fx[]={1,-1,0,0}, fy[]={0,0,1,-1};
int main() {
/*freopen("measurement.in","r",stdin);
freopen("measurement.out","w", stdout);*/
x_x
int n; cin>>n; string ar[n];
for (auto&i:ar) cin>>i;
ll ans=0;
for (int i=0; i<n; i++ ){
for (int j=0; j<n; j++) {
if (i==j)continue;
for (int k=0; (k+ar[i].size())<=ar[j].size(); k++) {
if (ar[j].substr(k,ar[i].size())==ar[i]){ans++; break;}
}
}
}
cout<<ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
4 ms |
348 KB |
Output is correct |
5 |
Correct |
23 ms |
492 KB |
Output is correct |
6 |
Correct |
48 ms |
484 KB |
Output is correct |
7 |
Correct |
95 ms |
512 KB |
Output is correct |
8 |
Correct |
80 ms |
344 KB |
Output is correct |
9 |
Execution timed out |
1068 ms |
600 KB |
Time limit exceeded |
10 |
Execution timed out |
1075 ms |
604 KB |
Time limit exceeded |
11 |
Execution timed out |
1049 ms |
860 KB |
Time limit exceeded |
12 |
Execution timed out |
1059 ms |
860 KB |
Time limit exceeded |
13 |
Execution timed out |
1027 ms |
1112 KB |
Time limit exceeded |
14 |
Execution timed out |
1038 ms |
1112 KB |
Time limit exceeded |
15 |
Execution timed out |
1022 ms |
1112 KB |
Time limit exceeded |
16 |
Execution timed out |
1090 ms |
1112 KB |
Time limit exceeded |
17 |
Execution timed out |
1044 ms |
1116 KB |
Time limit exceeded |
18 |
Execution timed out |
1061 ms |
1116 KB |
Time limit exceeded |
19 |
Execution timed out |
1069 ms |
1116 KB |
Time limit exceeded |
20 |
Execution timed out |
1049 ms |
1116 KB |
Time limit exceeded |