結果

問題 No.1304 あなたは基本が何か知っていますか?私は知っています.
ユーザー vwxyzvwxyz
提出日時 2023-03-20 02:10:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 379 ms / 2,000 ms
コード長 1,889 bytes
コンパイル時間 1,771 ms
コンパイル使用メモリ 82,200 KB
実行使用メモリ 257,452 KB
最終ジャッジ日時 2024-06-12 18:14:44
合計ジャッジ時間 11,345 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
92,848 KB
testcase_01 AC 98 ms
109,432 KB
testcase_02 AC 67 ms
92,596 KB
testcase_03 AC 379 ms
257,452 KB
testcase_04 AC 85 ms
92,292 KB
testcase_05 AC 76 ms
92,332 KB
testcase_06 AC 76 ms
92,484 KB
testcase_07 AC 82 ms
92,252 KB
testcase_08 AC 112 ms
101,504 KB
testcase_09 AC 78 ms
92,228 KB
testcase_10 AC 74 ms
92,800 KB
testcase_11 AC 77 ms
92,288 KB
testcase_12 AC 79 ms
92,440 KB
testcase_13 AC 73 ms
92,508 KB
testcase_14 AC 76 ms
92,504 KB
testcase_15 AC 75 ms
92,540 KB
testcase_16 AC 78 ms
92,788 KB
testcase_17 AC 106 ms
109,208 KB
testcase_18 AC 75 ms
92,236 KB
testcase_19 AC 71 ms
92,420 KB
testcase_20 AC 69 ms
92,420 KB
testcase_21 AC 105 ms
109,224 KB
testcase_22 AC 83 ms
92,108 KB
testcase_23 AC 84 ms
92,208 KB
testcase_24 AC 83 ms
92,384 KB
testcase_25 AC 175 ms
138,928 KB
testcase_26 AC 106 ms
101,840 KB
testcase_27 AC 112 ms
101,640 KB
testcase_28 AC 140 ms
124,604 KB
testcase_29 AC 111 ms
101,984 KB
testcase_30 AC 164 ms
139,068 KB
testcase_31 AC 225 ms
168,224 KB
testcase_32 AC 113 ms
101,704 KB
testcase_33 AC 173 ms
139,092 KB
testcase_34 AC 111 ms
102,100 KB
testcase_35 AC 159 ms
139,012 KB
testcase_36 AC 194 ms
153,792 KB
testcase_37 AC 162 ms
139,088 KB
testcase_38 AC 159 ms
139,968 KB
testcase_39 AC 246 ms
192,052 KB
testcase_40 AC 178 ms
139,472 KB
testcase_41 AC 258 ms
191,340 KB
testcase_42 AC 162 ms
139,264 KB
testcase_43 AC 164 ms
139,292 KB
testcase_44 AC 199 ms
153,508 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 36 ms
61,576 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