結果

問題 No.1958 Bit Game
ユーザー titiatitia
提出日時 2022-05-27 22:16:42
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 1,140 ms / 2,000 ms
コード長 628 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 81,852 KB
実行使用メモリ 143,548 KB
最終ジャッジ日時 2023-10-20 20:23:41
合計ジャッジ時間 21,831 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,130 ms
143,280 KB
testcase_01 AC 1,121 ms
143,284 KB
testcase_02 AC 1,129 ms
143,280 KB
testcase_03 AC 1,124 ms
143,280 KB
testcase_04 AC 1,121 ms
143,296 KB
testcase_05 AC 1,130 ms
143,280 KB
testcase_06 AC 1,128 ms
143,548 KB
testcase_07 AC 1,130 ms
143,284 KB
testcase_08 AC 1,140 ms
143,284 KB
testcase_09 AC 1,125 ms
143,280 KB
testcase_10 AC 125 ms
89,084 KB
testcase_11 AC 311 ms
106,900 KB
testcase_12 AC 414 ms
111,988 KB
testcase_13 AC 348 ms
105,992 KB
testcase_14 AC 377 ms
105,400 KB
testcase_15 AC 328 ms
110,248 KB
testcase_16 AC 198 ms
105,036 KB
testcase_17 AC 876 ms
113,492 KB
testcase_18 AC 703 ms
114,276 KB
testcase_19 AC 276 ms
110,956 KB
testcase_20 AC 411 ms
103,572 KB
testcase_21 AC 420 ms
114,412 KB
testcase_22 AC 137 ms
89,188 KB
testcase_23 AC 159 ms
101,612 KB
testcase_24 AC 745 ms
119,332 KB
testcase_25 AC 218 ms
104,876 KB
testcase_26 AC 321 ms
108,660 KB
testcase_27 AC 265 ms
106,368 KB
testcase_28 AC 643 ms
106,276 KB
testcase_29 AC 154 ms
98,928 KB
testcase_30 AC 37 ms
53,576 KB
testcase_31 AC 37 ms
53,576 KB
testcase_32 AC 42 ms
59,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,X,Y=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

mod=998244353

ANS=0

for i in range(18):
    X0=0
    X1=0
    Y0=0
    Y1=0

    for a in A:
        if a & (1<<i) == 0:
            X0+=1
        else:
            X1+=1

    for b in B:
        if b & (1<<i) == 0:
            Y0+=1
        else:
            Y1+=1

    #print(i,X0,X1,Y0,Y1)

    DP=[1,0]

    for j in range(N):
        k=DP[0]*X1*Y1+DP[1]*(X0+X1)*Y1
        l=(DP[0]+DP[1])*(X0+X1)*(Y0+Y1)-k

        #print(k,l)

        DP=[l%mod,k%mod]

        #print(DP)

    ANS+=pow(2,i,mod)*DP[1]%mod

print(ANS%mod)
0