답안 #909001

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
909001 2024-01-17T04:26:25 Z ibm2006 Cubeword (CEOI19_cubeword) C++17
0 / 100
1046 ms 7504 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll n,i,j,k,l,r,x,y,z,w,s,t,a[12][110][110],dp[110][110][110],m;
const ll mod=998244353;
char c[110000];
ll tr(char c)
{
    if(c>='a')
        return c-'a'+1;
    if(c>='A')
        return c-'A'+1+26;
    return c-'0'+1+26+26;
}
ll palin()
{
    ll i;
    for(i=0;i<m;i++)
    {
        if(c[i]!=c[m-1-i])
            return 0;
    }
    return 1;
}
ll f(ll x)
{
    ll i,t=0,j,k,l;
    for(i=1;i<=62;i++)
    {
        for(j=1;j<=62;j++)
        {
            for(k=1;k<=62;k++)
            {
                dp[i][j][k]=0;
                for(l=1;l<=62;l++)
                {
                    dp[i][j][k]+=a[x][i][l]*a[x][j][l]*a[x][k][l];
                    dp[i][j][k]%=mod;
                }
            }
        }
    }
    for(i=1;i<=62;i++)
    {
        for(j=1;j<=62;j++)
        {
            for(k=1;k<=62;k++)
            {
                for(l=1;l<=62;l++)
                {
                    t=(t+dp[i][j][k]*dp[i][j][l]%mod*dp[i][k][l]%mod*dp[j][k][l]%mod)%mod;
                }
            }
        }
    }
    return t;
}
int main()
{
    scanf("%lld",&n);
    for(i=1;i<=n;i++)
    {
        scanf("\n%s",c);
        m=strlen(c);
        x=tr(c[0]);
        y=tr(c[m-1]);
        if(palin())
        {
            a[m][x][y]++;
        }
        else
        {
            a[m][x][y]++;
            a[m][y][x]++;
        }
    }
    printf("!");
    for(i=3;i<=10;i++)
    {
        s=(s+f(i))%mod;
    }
    printf("%lld",s);
}

Compilation message

cubeword.cpp: In function 'int main()':
cubeword.cpp:60:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   60 |     scanf("%lld",&n);
      |     ~~~~~^~~~~~~~~~~
cubeword.cpp:63:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   63 |         scanf("\n%s",c);
      |         ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1046 ms 7504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1046 ms 7504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1046 ms 7504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1046 ms 7504 KB Output isn't correct
2 Halted 0 ms 0 KB -