Submission #948519

# Submission time Handle Problem Language Result Execution time Memory
948519 2024-03-18T07:29:02 Z GrandTiger1729 Cubeword (CEOI19_cubeword) C++17
0 / 100
1068 ms 17088 KB
#include <bits/stdc++.h>
using namespace std;

namespace
{
const int N = 11, K = 128, MOD = 998244353;
int a[N][K][K]{};
long long res[K][K][K]{};
const string charset = "0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";
}
int main()
{
    cin.tie(0)->sync_with_stdio(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        string ss = s;
        reverse(ss.begin(), ss.end());
        if (s == ss)
        {
            a[s.size()][s[0]][ss[0]]++;
        }
        else
        {
            a[s.size()][s[0]][ss[0]]++;
            a[s.size()][ss[0]][s[0]]++;
        }
    }
    long long ans = 0;
    for (int t = 3; t < N; t++)
    {
        fill_n(&res[0][0][0], sizeof(res) / sizeof(long long), 0);
        for (int i : charset)
        {
            for (int j : charset)
            {
                for (int k : charset)
                {
                    for (int l : charset)
                    {
                        (res[i][j][k] += 1ll * a[t][i][l] * a[t][j][l] * a[t][k][l]) %= MOD;
                    }
                }
            }
        }
        for (int i : charset)
        {
            for (int j : charset)
            {
                for (int k : charset)
                {
                    for (int l : charset)
                    {
                        (ans += res[i][j][k] * res[i][j][l] % MOD * res[i][k][l] % MOD * res[j][k][l]) %= MOD;
                    }
                }
            }
        }
    }
    cout << ans << '\n';
    return 0;
}

Compilation message

cubeword.cpp: In function 'int main()':
cubeword.cpp:24:29: warning: array subscript has type 'char' [-Wchar-subscripts]
   24 |             a[s.size()][s[0]][ss[0]]++;
      |                             ^
cubeword.cpp:24:36: warning: array subscript has type 'char' [-Wchar-subscripts]
   24 |             a[s.size()][s[0]][ss[0]]++;
      |                                    ^
cubeword.cpp:28:29: warning: array subscript has type 'char' [-Wchar-subscripts]
   28 |             a[s.size()][s[0]][ss[0]]++;
      |                             ^
cubeword.cpp:28:36: warning: array subscript has type 'char' [-Wchar-subscripts]
   28 |             a[s.size()][s[0]][ss[0]]++;
      |                                    ^
cubeword.cpp:29:30: warning: array subscript has type 'char' [-Wchar-subscripts]
   29 |             a[s.size()][ss[0]][s[0]]++;
      |                              ^
cubeword.cpp:29:36: warning: array subscript has type 'char' [-Wchar-subscripts]
   29 |             a[s.size()][ss[0]][s[0]]++;
      |                                    ^
# Verdict Execution time Memory Grader output
1 Incorrect 1068 ms 17088 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1068 ms 17088 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1068 ms 17088 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1068 ms 17088 KB Output isn't correct
2 Halted 0 ms 0 KB -