#include <bits/stdc++.h>
#define MOD 998244353
using namespace std;
struct wow
{
int pal,lung;
char st,dr;
}v[100005];
string s;
map <string,int> m;
int nr[15][105][105],n,i,j,t,k,z,sum,din[105][105][105];
void adds(string s)
{
if (m[s]!=0)
{
return;
}
m[s]=1;
nr[s.size()][s[0]][s.back()]++;
}
int main()
{
#ifdef HOME
ifstream cin("date.in");
ofstream cout("date.out");
#endif // HOME
cin>>n;
for (i=1;i<=n;i++)
{
cin>>s;
for (j=0;j<s.size();j++)
{
if ('a'<=s[j]&&s[j]<='z')
{
s[j]=s[j]-'a';
}
else
if ('A'<=s[j]&&s[j]<='Z')
{
s[j]=s[j]-'A'+26;
}
else
{
s[j]=s[j]-'0'+52;
}
}
adds(s);
reverse(s.begin(),s.end());
adds(s);
}
sum=0;
for (i=3;i<=10;i++)
{
memset(din,0,sizeof(din));
for (k=0;k<=20;k++)
{
for (t=0;t<=20;t++)
{
for (j=0;j<=20;j++)
{
for (z=0;z<=20;z++)
{
din[t][j][z]=(din[t][j][z]+1LL*nr[i][k][t]*nr[i][k][j]*nr[i][k][z])%MOD;
}
}
}
}
for (k=0;k<=20;k++)
{
for (t=0;t<=20;t++)
{
for (j=0;j<=20;j++)
{
for (z=0;z<=20;z++)
{
sum=(sum+1LL*din[k][t][j]*din[k][t][z]*din[k][j][z]*din[t][j][z])%MOD;
}
}
}
}
}
cout<<sum;
return 0;
}
Compilation message
cubeword.cpp: In function 'void adds(std::__cxx11::string)':
cubeword.cpp:19:22: warning: array subscript has type 'char' [-Wchar-subscripts]
nr[s.size()][s[0]][s.back()]++;
^
cubeword.cpp:19:32: warning: array subscript has type 'char' [-Wchar-subscripts]
nr[s.size()][s[0]][s.back()]++;
^
cubeword.cpp: In function 'int main()':
cubeword.cpp:31:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (j=0;j<s.size();j++)
~^~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
395 ms |
19472 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
395 ms |
19472 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
395 ms |
19472 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
395 ms |
19472 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |