結果

問題 No.1958 Bit Game
コンテスト
ユーザー hir355
提出日時 2022-05-27 22:10:10
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 1,564 ms / 2,000 ms
コード長 551 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 368 ms
コンパイル使用メモリ 85,120 KB
実行使用メモリ 126,492 KB
最終ジャッジ日時 2026-04-09 02:15:20
合計ジャッジ時間 35,061 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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
    p, q = 1, 1
    for j in range(n):
        ans += p * pow(cy, n - j, MOD) * q * pow(x - cx, n - j - 1, MOD) * cx % MOD
        p *= y
        q *= x
        p %= MOD
        q %= MOD
    res += ans << i
print(res % MOD)
0