#include <bits/stdc++.h>
using namespace std;
#define fi ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//#define ll double
#define ll long long
#define F first
#define S second
#define sz size()
#define all(s) s.begin(),s.end()
#define all1(s) s.rbegin(),s.rend()
int main()
{
// freopen("maxcross.in","r",stdin);freopen("maxcross.out","w",stdout);
ll T=1;
//cin>>T;ll oo=0;
while(T--)
{
ll n;
cin>>n;
string a[n];
map<string,ll>m,d;
for(ll i=0; i<n; i++)
{
cin>>a[i];
string e="";
for(ll j=0; j<a[i].sz; j++)
{
e+=a[i][j];
d[e]=1;
}e+=a[i][a[i].sz-1];
m[a[i]]++;
}
ll c=0;
for(ll i=0; i<n; i++)
{
for(ll j=0; j<a[i].sz; j++)
{
string e="";
e+=a[i][j];
ll k=0;c+=(m[e]-(e==a[i]));
while(d[e]||m[e])
{
k++;
if(k+j<a[i].sz){
e+=a[i][j+k];c+=(m[e]-(e==a[i]));}
else break;
}
}
}
cout<<c;
}
}
Compilation message
lozinke.cpp: In function 'int main()':
lozinke.cpp:27:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
27 | for(ll j=0; j<a[i].sz; j++)
| ^
lozinke.cpp:37:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
37 | for(ll j=0; j<a[i].sz; j++)
| ^
lozinke.cpp:45:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
45 | if(k+j<a[i].sz){
| ^
# |
결과 |
실행 시간 |
메모리 |
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 |
344 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
5 |
Incorrect |
7 ms |
792 KB |
Output isn't correct |
6 |
Incorrect |
12 ms |
856 KB |
Output isn't correct |
7 |
Incorrect |
14 ms |
1628 KB |
Output isn't correct |
8 |
Correct |
20 ms |
2648 KB |
Output is correct |
9 |
Incorrect |
67 ms |
3412 KB |
Output isn't correct |
10 |
Correct |
128 ms |
8088 KB |
Output is correct |
11 |
Incorrect |
121 ms |
5940 KB |
Output isn't correct |
12 |
Correct |
276 ms |
15184 KB |
Output is correct |
13 |
Incorrect |
211 ms |
4316 KB |
Output isn't correct |
14 |
Incorrect |
211 ms |
15996 KB |
Output isn't correct |
15 |
Correct |
309 ms |
16720 KB |
Output is correct |
16 |
Incorrect |
191 ms |
1356 KB |
Output isn't correct |
17 |
Correct |
58 ms |
1112 KB |
Output is correct |
18 |
Incorrect |
40 ms |
1028 KB |
Output isn't correct |
19 |
Incorrect |
218 ms |
10320 KB |
Output isn't correct |
20 |
Incorrect |
92 ms |
1324 KB |
Output isn't correct |