結果

問題 No.1958 Bit Game
ユーザー rlangevinrlangevin
提出日時 2023-11-01 12:24:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 326 ms / 2,000 ms
コード長 734 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 81,816 KB
実行使用メモリ 143,512 KB
最終ジャッジ日時 2023-11-01 12:24:38
合計ジャッジ時間 11,167 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 326 ms
143,380 KB
testcase_01 AC 289 ms
143,264 KB
testcase_02 AC 290 ms
143,260 KB
testcase_03 AC 291 ms
143,260 KB
testcase_04 AC 325 ms
143,280 KB
testcase_05 AC 295 ms
143,256 KB
testcase_06 AC 292 ms
143,512 KB
testcase_07 AC 288 ms
143,260 KB
testcase_08 AC 312 ms
143,260 KB
testcase_09 AC 286 ms
143,256 KB
testcase_10 AC 105 ms
86,876 KB
testcase_11 AC 163 ms
106,896 KB
testcase_12 AC 174 ms
107,036 KB
testcase_13 AC 210 ms
104,452 KB
testcase_14 AC 182 ms
105,396 KB
testcase_15 AC 168 ms
109,984 KB
testcase_16 AC 127 ms
103,976 KB
testcase_17 AC 242 ms
112,988 KB
testcase_18 AC 223 ms
114,260 KB
testcase_19 AC 174 ms
110,952 KB
testcase_20 AC 206 ms
103,568 KB
testcase_21 AC 185 ms
114,396 KB
testcase_22 AC 126 ms
86,492 KB
testcase_23 AC 118 ms
101,876 KB
testcase_24 AC 234 ms
112,624 KB
testcase_25 AC 134 ms
104,828 KB
testcase_26 AC 198 ms
108,656 KB
testcase_27 AC 153 ms
106,364 KB
testcase_28 AC 216 ms
103,416 KB
testcase_29 AC 131 ms
96,168 KB
testcase_30 AC 33 ms
53,632 KB
testcase_31 AC 33 ms
53,632 KB
testcase_32 AC 38 ms
59,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def solve(a0, a1, b0, b1, v):
    pre0, pre1 = 1, 0
    for i in range(2 * N):
        if i % 2 == 0:
            dp0 = a0 * pre0
            dp1 = a1 * pre0 + (a0 + a1) * pre1
        else:
            dp0 = (b0 + b1) * pre0 + b0 * pre1
            dp1 = b1 * pre1
        pre0 = dp0 % mod
        pre1 = dp1 % mod
    return pre1 * v % mod

ans = 0
v = 1
for i in range(25):
    a, b = [0] * 2, [0] * 2
    for j in range(X):
        a[(A[j] >> i) & 1] += 1
    for j in range(Y):
        b[(B[j] >> i) & 1] += 1
    ans += solve(a[0], a[1], b[0], b[1], v)
    ans %= mod
    v *= 2
    v %= mod

print(ans)
0