結果

問題 No.1958 Bit Game
ユーザー siganaisiganai
提出日時 2022-05-27 22:37:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 389 ms / 2,000 ms
コード長 1,110 bytes
コンパイル時間 177 ms
コンパイル使用メモリ 81,536 KB
実行使用メモリ 153,516 KB
最終ジャッジ日時 2023-10-20 20:30:09
合計ジャッジ時間 11,173 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 387 ms
153,244 KB
testcase_01 AC 385 ms
153,252 KB
testcase_02 AC 385 ms
153,248 KB
testcase_03 AC 389 ms
153,240 KB
testcase_04 AC 382 ms
153,228 KB
testcase_05 AC 385 ms
153,244 KB
testcase_06 AC 383 ms
153,516 KB
testcase_07 AC 381 ms
153,244 KB
testcase_08 AC 382 ms
153,248 KB
testcase_09 AC 381 ms
153,244 KB
testcase_10 AC 155 ms
86,636 KB
testcase_11 AC 225 ms
103,884 KB
testcase_12 AC 246 ms
111,372 KB
testcase_13 AC 251 ms
110,624 KB
testcase_14 AC 233 ms
93,908 KB
testcase_15 AC 252 ms
130,948 KB
testcase_16 AC 186 ms
101,040 KB
testcase_17 AC 335 ms
140,812 KB
testcase_18 AC 312 ms
139,992 KB
testcase_19 AC 228 ms
120,384 KB
testcase_20 AC 258 ms
100,476 KB
testcase_21 AC 271 ms
137,620 KB
testcase_22 AC 172 ms
89,484 KB
testcase_23 AC 164 ms
97,196 KB
testcase_24 AC 301 ms
115,652 KB
testcase_25 AC 186 ms
93,248 KB
testcase_26 AC 259 ms
106,668 KB
testcase_27 AC 232 ms
124,828 KB
testcase_28 AC 285 ms
107,340 KB
testcase_29 AC 190 ms
93,572 KB
testcase_30 AC 55 ms
63,548 KB
testcase_31 AC 56 ms
63,548 KB
testcase_32 AC 62 ms
66,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env PyPy3

from collections import Counter, defaultdict, deque
import itertools
import re
import math
from functools import reduce
import operator
import bisect
from heapq import *
import functools
mod=998244353

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()))
bina = [0] * 18
binb = [0] * 18
for aa in a:
    for i in range(18):
        if aa >> i & 1:
            bina[i] += 1
for bb in b:
    for i in range(18):
        if bb >> i & 1:
            binb[i] += 1
ans = 0
for i in range(18):
    if binb[i] == 0:continue
    m = 1 << i
    powb = pow(y,n,mod)
    powa = pow(x,n,mod)
    ans += powa * powb % mod * m % mod
    ans %= mod
    invb = pow(y,mod-2,mod)
    inva = pow(x,mod-2,mod)
    for j in range(n):
        powb *= invb
        powb %= mod
        ans -= powb * (y - binb[i]) % mod * powa % mod * m % mod
        ans %= mod
        powb *= binb[i]
        powb %= mod
        powa *= inva * (x - bina[i]) % mod
        powa %= mod
    ans -= powb * powa % mod * m % mod
    ans %= mod
print(ans)
0