結果

問題 No.1958 Bit Game
ユーザー ああいいああいい
提出日時 2022-05-28 16:49:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 262 ms / 2,000 ms
コード長 678 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 81,772 KB
実行使用メモリ 143,292 KB
最終ジャッジ日時 2023-10-20 23:25:59
合計ジャッジ時間 8,121 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 258 ms
143,136 KB
testcase_01 AC 257 ms
143,040 KB
testcase_02 AC 262 ms
143,044 KB
testcase_03 AC 260 ms
143,040 KB
testcase_04 AC 255 ms
143,036 KB
testcase_05 AC 256 ms
143,024 KB
testcase_06 AC 252 ms
143,292 KB
testcase_07 AC 260 ms
143,028 KB
testcase_08 AC 254 ms
143,040 KB
testcase_09 AC 253 ms
143,044 KB
testcase_10 AC 101 ms
89,104 KB
testcase_11 AC 143 ms
106,720 KB
testcase_12 AC 176 ms
106,836 KB
testcase_13 AC 157 ms
104,232 KB
testcase_14 AC 143 ms
105,220 KB
testcase_15 AC 200 ms
110,068 KB
testcase_16 AC 153 ms
104,856 KB
testcase_17 AC 211 ms
112,752 KB
testcase_18 AC 217 ms
114,084 KB
testcase_19 AC 172 ms
110,776 KB
testcase_20 AC 149 ms
103,392 KB
testcase_21 AC 204 ms
114,224 KB
testcase_22 AC 90 ms
87,152 KB
testcase_23 AC 128 ms
101,368 KB
testcase_24 AC 190 ms
112,420 KB
testcase_25 AC 131 ms
104,632 KB
testcase_26 AC 144 ms
108,480 KB
testcase_27 AC 187 ms
106,188 KB
testcase_28 AC 168 ms
103,212 KB
testcase_29 AC 103 ms
95,980 KB
testcase_30 AC 35 ms
53,392 KB
testcase_31 AC 35 ms
53,392 KB
testcase_32 AC 35 ms
53,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

P = 998244353

ans = 0
for i in range(18):
    a = 0
    b = 0
    mask = 1 << i
    for j in A:
        if mask & j:a += 1
    for j in B:
        if mask & j:b += 1
    tmp = 0
    x = 1
    y = 1
    if b == 0:continue
    if a == X:
        tmp = pow(X,N - 1,P) * a * pow(Y,N - 1,P) * b % P
        ans += tmp
        continue
    u = a * pow(X - a,N - 1,P) * pow(b,N,P) % P
    r = X * Y * pow(b * (X - a),P - 2,P) % P
    if r == 1:
        v = N
    else:
        v = (1 - pow(r,N,P)) * pow(1 - r,P - 2,P) % P
    ans += u * v % P * mask % P
    
print(ans % P)
    
0