Submission #260465

#TimeUsernameProblemLanguageResultExecution timeMemory
260465stefantagaCubeword (CEOI19_cubeword)C++14
0 / 100
1126 ms24900 KiB
#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; long long 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<=61;k++) { for (t=0;t<=61;t++) { for (j=0;j<=61;j++) { for (z=0;z<=61;z++) { din[t][j][z]=(din[t][j][z]+nr[i][k][t]*nr[i][k][j]*nr[i][k][z])%MOD; } } } } for (k=0;k<=61;k++) { for (t=0;t<=61;t++) { for (j=0;j<=61;j++) { for (z=0;z<=61;z++) { sum=(sum+din[k][t][j]*din[k][t][z]*din[k][j][z]*din[t][j][z])%MOD; } } } } } cout<<sum; return 0; }

Compilation message (stderr)

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++)
                  ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...