結果

問題 No.1958 Bit Game
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-05-27 22:28:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 406 ms / 2,000 ms
コード長 714 bytes
コンパイル時間 420 ms
コンパイル使用メモリ 81,560 KB
実行使用メモリ 143,004 KB
最終ジャッジ日時 2023-10-20 20:28:00
合計ジャッジ時間 11,405 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 403 ms
143,004 KB
testcase_01 AC 402 ms
142,740 KB
testcase_02 AC 402 ms
142,740 KB
testcase_03 AC 400 ms
142,740 KB
testcase_04 AC 396 ms
142,756 KB
testcase_05 AC 395 ms
142,740 KB
testcase_06 AC 406 ms
143,004 KB
testcase_07 AC 401 ms
142,740 KB
testcase_08 AC 404 ms
142,740 KB
testcase_09 AC 399 ms
142,740 KB
testcase_10 AC 147 ms
88,824 KB
testcase_11 AC 230 ms
106,716 KB
testcase_12 AC 252 ms
111,632 KB
testcase_13 AC 262 ms
105,632 KB
testcase_14 AC 240 ms
105,216 KB
testcase_15 AC 242 ms
110,064 KB
testcase_16 AC 183 ms
103,796 KB
testcase_17 AC 340 ms
112,892 KB
testcase_18 AC 311 ms
114,076 KB
testcase_19 AC 212 ms
110,772 KB
testcase_20 AC 271 ms
103,388 KB
testcase_21 AC 257 ms
114,216 KB
testcase_22 AC 173 ms
88,928 KB
testcase_23 AC 163 ms
101,616 KB
testcase_24 AC 328 ms
118,980 KB
testcase_25 AC 188 ms
104,884 KB
testcase_26 AC 266 ms
108,476 KB
testcase_27 AC 223 ms
106,184 KB
testcase_28 AC 301 ms
106,636 KB
testcase_29 AC 187 ms
98,672 KB
testcase_30 AC 39 ms
53,376 KB
testcase_31 AC 38 ms
53,376 KB
testcase_32 AC 45 ms
61,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,x,y = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
mod = 998244353

ans = 0
for i in range(18):
    nA = [0,0]
    nB = [0,0]
    for a in A:
        if a >> i & 1:
            nA[1] += 1
        else:
            nA[0] += 1
    for b in B:
        if b >> i & 1:
            nB[1] += 1
        else:
            nB[0] += 1

    dp = [1,0]

    for j in range(n):
        ndp = [0,0]
        ndp[0] = dp[0]*nA[0]%mod
        ndp[1] = (dp[0]*nA[1] + dp[1]*x)%mod
        dp = ndp

        ndp = [0,0]
        ndp[0] = (dp[0]*y + dp[1]*nB[0])%mod
        ndp[1] = dp[1]*nB[1]%mod
        dp = ndp

    ans += (1<<i)*dp[1]%mod
    ans %= mod
print(ans)
            
0