結果

問題 No.1958 Bit Game
ユーザー roaris
提出日時 2022-06-03 00:30:09
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 608 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 82,600 KB
実行使用メモリ 849,296 KB
最終ジャッジ日時 2024-09-21 02:13:11
合計ジャッジ時間 6,721 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other MLE * 1 -- * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, X, Y = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
MOD = 998244353

for b in range(20):
    x = 0
    
    for Ai in A:
        x += (Ai>>b)&1
    
    y = 0
    
    for Bi in B:
        y += (Bi>>b)&1
    
    dp = [[0]*2 for _ in range(N+1)]
    dp[0][0] = 1
    
    for i in range(N):
        dp[i+1][0] = (((X-x)*(Y-y)+(X-x)*y+x*(Y-y))*dp[i][0]+((X-x)*(Y-y)+x*(Y-y))*dp[i][1])
        dp[i+1][1] = (x*y*dp[i][0]+((X-x)*y+x*y)*dp[i][1])
    
    ans += (1<<b)*dp[N][1]%MOD
    ans %= MOD

print(ans)
0