結果

問題 No.1958 Bit Game
ユーザー lilictakalilictaka
提出日時 2022-06-02 00:16:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,876 ms / 2,000 ms
コード長 613 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 81,820 KB
実行使用メモリ 262,708 KB
最終ジャッジ日時 2023-10-21 01:02:25
合計ジャッジ時間 33,300 ms
ジャッジサーバーID
(参考情報)
judge10 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,850 ms
262,272 KB
testcase_01 AC 1,872 ms
261,756 KB
testcase_02 AC 1,861 ms
262,476 KB
testcase_03 AC 1,847 ms
262,128 KB
testcase_04 AC 1,865 ms
262,204 KB
testcase_05 AC 1,863 ms
262,448 KB
testcase_06 AC 1,867 ms
262,484 KB
testcase_07 AC 1,869 ms
262,708 KB
testcase_08 AC 1,876 ms
262,408 KB
testcase_09 AC 1,864 ms
262,412 KB
testcase_10 AC 135 ms
96,760 KB
testcase_11 AC 425 ms
133,984 KB
testcase_12 AC 652 ms
156,836 KB
testcase_13 AC 344 ms
128,012 KB
testcase_14 AC 551 ms
176,088 KB
testcase_15 AC 399 ms
110,232 KB
testcase_16 AC 215 ms
103,984 KB
testcase_17 AC 1,474 ms
230,748 KB
testcase_18 AC 1,169 ms
192,312 KB
testcase_19 AC 349 ms
110,940 KB
testcase_20 AC 448 ms
159,036 KB
testcase_21 AC 597 ms
122,132 KB
testcase_22 AC 154 ms
110,516 KB
testcase_23 AC 147 ms
101,544 KB
testcase_24 AC 1,333 ms
255,332 KB
testcase_25 AC 215 ms
105,072 KB
testcase_26 AC 317 ms
124,840 KB
testcase_27 AC 318 ms
106,352 KB
testcase_28 AC 1,162 ms
253,068 KB
testcase_29 AC 159 ms
106,216 KB
testcase_30 AC 35 ms
53,576 KB
testcase_31 AC 36 ms
53,576 KB
testcase_32 AC 41 ms
59,876 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 k in range(18):
    x = 0
    y = 0
    for a in A:
        if (a >> k) & 1:
            x += 1
    for b in B:
        if (b >> k) & 1:
            y += 1
    dp = [[0] * (N+1) for _ in range(2)]
    dp[0][0] = 1
    for n in range(1,N+1):
        dp[1][n] = dp[0][n-1] * x * y + dp[1][n-1] * X * y
        dp[1][n] %= mod
        dp[0][n] = dp[0][n-1] * (X*Y-x*y) + dp[1][n-1] * (X * (Y-y))
        dp[0][n] %= mod
    ans += dp[1][N] * pow(2,k,mod)
    ans %= mod
print(ans)
    
0