結果

問題 No.1958 Bit Game
ユーザー 👑 KazunKazun
提出日時 2022-05-27 21:46:06
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 726 bytes
コンパイル時間 145 ms
コンパイル使用メモリ 81,864 KB
実行使用メモリ 143,428 KB
最終ジャッジ日時 2023-10-20 20:05:50
合計ジャッジ時間 55,475 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 TLE -
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 AC 879 ms
88,920 KB
testcase_11 AC 1,312 ms
106,604 KB
testcase_12 AC 1,091 ms
112,404 KB
testcase_13 AC 1,765 ms
105,688 KB
testcase_14 AC 1,694 ms
105,104 KB
testcase_15 AC 447 ms
109,688 KB
testcase_16 AC 235 ms
103,684 KB
testcase_17 TLE -
testcase_18 AC 1,570 ms
113,952 KB
testcase_19 AC 526 ms
110,660 KB
testcase_20 TLE -
testcase_21 AC 755 ms
114,092 KB
testcase_22 AC 1,450 ms
89,288 KB
testcase_23 AC 498 ms
101,508 KB
testcase_24 TLE -
testcase_25 AC 792 ms
104,396 KB
testcase_26 TLE -
testcase_27 AC 316 ms
106,072 KB
testcase_28 TLE -
testcase_29 AC 1,285 ms
98,768 KB
testcase_30 AC 38 ms
53,360 KB
testcase_31 AC 38 ms
53,360 KB
testcase_32 AC 49 ms
66,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(N,X,Y,A,B):
    mu=max(max(A), max(B)).bit_length()

    Ans=0; Mod=998244353
    for d in range(mu):
        S=[0,0]; T=[0,0]

        for i in range(X):
            S[A[i]&1]+=1
            A[i]>>=1

        for j in range(Y):
            T[B[j]&1]+=1
            B[j]>>=1

        DP=[1,0]
        for _ in range(N):
            E=DP; DP=[0,0]
            for r in [0,1]:
                for p,q in [[0,0], [0,1], [1,0], [1,1]]:
                    h=S[p]*T[q]%Mod
                    DP[(r|p)&q]+=h*E[r]%Mod

            DP=[t%Mod for t in DP]
        Ans+=DP[1]*(1<<d)

    return Ans%Mod

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