#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define yes "YES"
#define no "NO"
#define bigg INT_MAX
#define debug(x) cout<<(#x)<<" = " <<x<<endl;
#define all(x) x.begin(),x.end()
#define sz size()
#define nn '\n'
#define mms(x,y) memset(x,y,sizeof(x))
#define forr(i,j,n) for (int i=j; i<n; i++)
#define forn(i,j,n) for (int i=j; i>n; i--)
#define fi first
#define se second
#define la "LA"
#define cinn(x,y) for(int i=0; i<y; i++) cin>>x[i];
#define pii pair<int,int>
signed main()
{
// #ifndef LOCAL
// freopen("helpcross.in","r",stdin);
// freopen("helpcross.out","w", stdout);
// #endif
fast
int n;
cin>>n;
string a[n];
map<string,int> m;
forr(i,0,n)
{
cin>>a[i];
m[a[i]]++;
}
int ans=0;
forr(k,0,n)
{
string s=a[k];
int w=s.sz;
forr(j,0,w)
{
string cur="";
forr(i,j,w)
{
cur+=s[i];
ans+=m[cur];
}
// cout<<k<<' '<<cur<<endl;
}
}
cout<<ans-n;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
5 |
Incorrect |
3 ms |
860 KB |
Output isn't correct |
6 |
Incorrect |
5 ms |
860 KB |
Output isn't correct |
7 |
Incorrect |
8 ms |
1356 KB |
Output isn't correct |
8 |
Correct |
17 ms |
2396 KB |
Output is correct |
9 |
Incorrect |
31 ms |
2452 KB |
Output isn't correct |
10 |
Correct |
71 ms |
7504 KB |
Output is correct |
11 |
Incorrect |
60 ms |
4396 KB |
Output isn't correct |
12 |
Correct |
153 ms |
16720 KB |
Output is correct |
13 |
Incorrect |
97 ms |
2848 KB |
Output isn't correct |
14 |
Incorrect |
121 ms |
14944 KB |
Output isn't correct |
15 |
Correct |
175 ms |
16464 KB |
Output is correct |
16 |
Incorrect |
82 ms |
1372 KB |
Output isn't correct |
17 |
Correct |
24 ms |
1108 KB |
Output is correct |
18 |
Incorrect |
19 ms |
1116 KB |
Output isn't correct |
19 |
Incorrect |
107 ms |
8784 KB |
Output isn't correct |
20 |
Incorrect |
44 ms |
1360 KB |
Output isn't correct |