結果

問題 No.1958 Bit Game
ユーザー ikomaikoma
提出日時 2022-05-27 21:54:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 309 ms / 2,000 ms
コード長 719 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 81,692 KB
実行使用メモリ 141,348 KB
最終ジャッジ日時 2023-10-20 20:11:37
合計ジャッジ時間 8,824 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 298 ms
141,348 KB
testcase_01 AC 309 ms
140,568 KB
testcase_02 AC 308 ms
140,568 KB
testcase_03 AC 299 ms
140,568 KB
testcase_04 AC 289 ms
140,600 KB
testcase_05 AC 300 ms
140,572 KB
testcase_06 AC 302 ms
140,828 KB
testcase_07 AC 299 ms
140,564 KB
testcase_08 AC 295 ms
140,564 KB
testcase_09 AC 292 ms
140,564 KB
testcase_10 AC 110 ms
88,348 KB
testcase_11 AC 172 ms
105,172 KB
testcase_12 AC 196 ms
111,572 KB
testcase_13 AC 187 ms
104,084 KB
testcase_14 AC 173 ms
103,620 KB
testcase_15 AC 199 ms
108,608 KB
testcase_16 AC 153 ms
103,124 KB
testcase_17 AC 263 ms
111,484 KB
testcase_18 AC 233 ms
112,480 KB
testcase_19 AC 180 ms
108,904 KB
testcase_20 AC 191 ms
101,864 KB
testcase_21 AC 216 ms
112,588 KB
testcase_22 AC 122 ms
88,600 KB
testcase_23 AC 133 ms
100,260 KB
testcase_24 AC 237 ms
118,924 KB
testcase_25 AC 144 ms
103,488 KB
testcase_26 AC 186 ms
106,936 KB
testcase_27 AC 186 ms
104,880 KB
testcase_28 AC 215 ms
106,840 KB
testcase_29 AC 136 ms
97,644 KB
testcase_30 AC 35 ms
53,532 KB
testcase_31 AC 35 ms
53,532 KB
testcase_32 AC 41 ms
59,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,X,Y=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
MOD=998244353
cnt1A = [0]*18
cnt1B = [0]*18
for a in A:
    for i in range(18):
        if (a>>i)&1:
            cnt1A[i]+=1
for b in B:
    for i in range(18):
        if (b>>i)&1:
            cnt1B[i]+=1

dp1 = [0]*18

for j in range(18):
    d0,d1=1,0
    na1=cnt1A[j]
    na0 = X-na1
    nb1=cnt1B[j]
    nb0 = Y-nb1
    for i in range(N):
        _d0 = d0 * na0 % MOD
        _d1 = (d0 * na1 + d1 * X) % MOD
        d0 = (_d0 * Y + _d1 * nb0) % MOD
        d1 = _d1 * nb1 % MOD
    dp1[j] = d1

ans=0
for i in range(18):
    ans += (dp1[i] << i) % MOD
    ans %= MOD
print(ans)
0