結果

問題 No.1304 あなたは基本が何か知っていますか?私は知っています.
ユーザー vwxyzvwxyz
提出日時 2023-03-20 02:10:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 460 ms / 2,000 ms
コード長 1,889 bytes
コンパイル時間 1,174 ms
コンパイル使用メモリ 86,864 KB
実行使用メモリ 256,224 KB
最終ジャッジ日時 2023-09-03 04:18:36
合計ジャッジ時間 16,284 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
92,684 KB
testcase_01 AC 143 ms
109,224 KB
testcase_02 AC 104 ms
92,360 KB
testcase_03 AC 460 ms
256,224 KB
testcase_04 AC 124 ms
92,144 KB
testcase_05 AC 114 ms
92,588 KB
testcase_06 AC 112 ms
92,540 KB
testcase_07 AC 120 ms
92,216 KB
testcase_08 AC 159 ms
109,008 KB
testcase_09 AC 120 ms
92,252 KB
testcase_10 AC 115 ms
92,124 KB
testcase_11 AC 117 ms
92,416 KB
testcase_12 AC 120 ms
92,376 KB
testcase_13 AC 112 ms
92,560 KB
testcase_14 AC 116 ms
92,524 KB
testcase_15 AC 113 ms
92,340 KB
testcase_16 AC 119 ms
92,348 KB
testcase_17 AC 147 ms
108,920 KB
testcase_18 AC 118 ms
92,568 KB
testcase_19 AC 111 ms
92,608 KB
testcase_20 AC 106 ms
92,324 KB
testcase_21 AC 148 ms
108,860 KB
testcase_22 AC 121 ms
92,276 KB
testcase_23 AC 122 ms
92,392 KB
testcase_24 AC 122 ms
92,320 KB
testcase_25 AC 245 ms
160,072 KB
testcase_26 AC 161 ms
109,168 KB
testcase_27 AC 164 ms
109,128 KB
testcase_28 AC 184 ms
123,568 KB
testcase_29 AC 161 ms
108,948 KB
testcase_30 AC 213 ms
138,136 KB
testcase_31 AC 283 ms
175,252 KB
testcase_32 AC 161 ms
108,692 KB
testcase_33 AC 244 ms
160,076 KB
testcase_34 AC 167 ms
109,192 KB
testcase_35 AC 215 ms
137,980 KB
testcase_36 AC 254 ms
152,500 KB
testcase_37 AC 214 ms
137,992 KB
testcase_38 AC 209 ms
139,252 KB
testcase_39 AC 303 ms
191,132 KB
testcase_40 AC 216 ms
137,940 KB
testcase_41 AC 318 ms
189,624 KB
testcase_42 AC 214 ms
138,008 KB
testcase_43 AC 216 ms
138,076 KB
testcase_44 AC 258 ms
152,200 KB
04_evil_A_01 RE -
04_evil_A_02 RE -
04_evil_A_03 RE -
04_evil_A_04 RE -
04_evil_A_05 RE -
04_evil_A_06 RE -
04_evil_A_07 RE -
04_evil_A_08 RE -
04_evil_A_09 RE -
04_evil_A_10 RE -
05_evil_B_01 RE -
05_evil_B_02 RE -
05_evil_B_03 RE -
05_evil_B_04 RE -
05_evil_B_05 RE -
05_evil_B_06 RE -
05_evil_B_07 RE -
05_evil_B_08 RE -
05_evil_B_09 RE -
05_evil_B_10 RE -
06_evil_C_01 RE -
06_evil_C_02 RE -
06_evil_C_03 RE -
06_evil_C_04 RE -
06_evil_C_05 RE -
06_evil_C_06 RE -
06_evil_C_07 RE -
06_evil_C_08 RE -
06_evil_C_09 RE -
06_evil_C_10 AC 74 ms
71,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline

def Hadamard(polynomial,n,mod=0,inverse=False):
    polynomial_=[x for x in polynomial]+[0]*((1<<n)-len(polynomial))
    for bit in range(n):
        for i in range(1<<n):
            ii=i^(1<<bit)
            if i>ii:
                continue
            polynomial_[i],polynomial_[ii]=polynomial_[i]+polynomial_[ii],polynomial_[i]-polynomial_[ii]
            if mod:
                polynomial_[i]%=mod
                polynomial_[ii]%=mod
    if inverse:
        if mod:
            inve_2=pow((mod+1)//2,n)
            for i in range(1<<n):
                polynomial_[i]*=inve_2
                polynomial_[i]%=mod
        else:
            pow_2=pow(2,n)
            for i in range(1<<n):
                polynomial_[i]/=pow_2
    return polynomial_

def XOR_Convolution(polynomial0,polynomial1,mod=0):
    n=(max(len(polynomial0),len(polynomial1))-1).bit_length()
    Hadamard_polynomial0=Hadamard(polynomial0,n,mod=mod)
    Hadamard_polynomial1=Hadamard(polynomial1,n,mod=mod)
    if mod:
        convolution=[x*y%mod for x,y in zip(Hadamard_polynomial0,Hadamard_polynomial1)]
    else:
        convolution=[x*y for x,y in zip(Hadamard_polynomial0,Hadamard_polynomial1)]
    convolution=Hadamard(convolution,n,mod=mod,inverse=True)
    return convolution

N,K,X,Y=map(int,readline().split())
Y+=1
A=list(map(int,readline().split()))
mod=998244353
dp=[[0]*(1<<10) for i in range(1<<10)]
for a in A:
    dp[a][a]=1
for n in range(1,N):
    prev=dp
    dp=[[0]*(1<<10) for i in range(1<<10)]
    cnt=[0]*(1<<10)
    for i in range(1<<10):
        for j in range(1<<10):
            cnt[j]+=prev[i][j]
            cnt[j]%=mod
    for a in A:
        for j in range(1<<10):
            dp[a][a^j]+=cnt[j]-prev[a][j]
            dp[a][a^j]%mod
ans=0
for i in range(1<<10):
    for j in range(X,Y):
        ans+=dp[i][j]
        ans%=mod
print(ans)
0