結果

問題 No.1958 Bit Game
ユーザー 👑 KazunKazun
提出日時 2022-05-27 21:42:15
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 693 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 81,620 KB
実行使用メモリ 143,232 KB
最終ジャッジ日時 2023-10-20 20:02:14
合計ジャッジ時間 55,395 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 894 ms
89,040 KB
testcase_11 AC 1,322 ms
106,696 KB
testcase_12 AC 1,110 ms
111,820 KB
testcase_13 AC 1,813 ms
105,824 KB
testcase_14 AC 1,739 ms
105,196 KB
testcase_15 AC 458 ms
110,044 KB
testcase_16 AC 245 ms
103,776 KB
testcase_17 TLE -
testcase_18 AC 1,606 ms
114,048 KB
testcase_19 AC 537 ms
110,752 KB
testcase_20 TLE -
testcase_21 AC 736 ms
114,192 KB
testcase_22 AC 1,436 ms
89,408 KB
testcase_23 AC 455 ms
101,608 KB
testcase_24 TLE -
testcase_25 AC 729 ms
104,608 KB
testcase_26 AC 1,925 ms
108,456 KB
testcase_27 AC 309 ms
106,164 KB
testcase_28 TLE -
testcase_29 AC 1,219 ms
98,884 KB
testcase_30 AC 35 ms
53,432 KB
testcase_31 AC 37 ms
53,432 KB
testcase_32 AC 49 ms
66,080 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 a in A:
            S[(a>>d)&1]+=1

        for b in B:
            T[(b>>d)&1]+=1

        DP=[1,0]
        for _ in range(N):
            E=DP; DP=[0,0]
            for r in [0,1]:
                for p in [0,1]:
                    for q in [0,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