結果

問題 No.1958 Bit Game
ユーザー hir355
提出日時 2022-05-27 22:14:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,931 ms / 2,000 ms
コード長 552 bytes
コンパイル時間 998 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 290,740 KB
最終ジャッジ日時 2024-12-30 15:03:28
合計ジャッジ時間 40,189 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
n, x, y = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
res = 0
for i in range(18):
    ans = 0
    cx = 0
    for j in range(x):
        if (a[j] >> i) & 1:
            cx += 1
    cy = 0
    for j in range(y):
        if (b[j] >> i) & 1:
            cy += 1
    d = [1] * n
    p, q = 1, cy
    for j in range(n):
        d[j] *= p * cx
        d[n - j - 1] *= q
        p *= y * x
        q *= cy * (x - cx)
        p %= MOD
        q %= MOD
    res += sum(d) << i
print(res % MOD)
0