結果

問題 No.1958 Bit Game
ユーザー hir355
提出日時 2022-05-27 22:10:10
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 551 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 154,256 KB
最終ジャッジ日時 2024-09-20 15:59:35
合計ジャッジ時間 7,332 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other TLE * 1 -- * 29
権限があれば一括ダウンロードができます

ソースコード

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
    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