結果

問題 No.1958 Bit Game
コンテスト
ユーザー hir355
提出日時 2022-05-27 22:14:53
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 1,840 ms / 2,000 ms
コード長 552 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 283 ms
コンパイル使用メモリ 77,928 KB
実行使用メモリ 253,464 KB
最終ジャッジ日時 2026-02-25 00:54:05
合計ジャッジ時間 38,619 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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