結果

問題 No.1958 Bit Game
ユーザー hir355hir355
提出日時 2022-05-27 22:09:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 530 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 82,164 KB
実行使用メモリ 78,260 KB
最終ジャッジ日時 2024-09-20 15:59:27
合計ジャッジ時間 62,663 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
n, x, y = 100000, 100000, 100000
a = list(range(1, 100001))
b = list(range(1, 100001))
res = 0
for i in range(18):
    ans = 0
    cx = 0
    for j in range(x):
        if (a[j] >> i) & 1:
            cx += 1
    cy = 0
    for j in range(y):
        if (b[j] >> i) & 1:
            cy += 1
    p, q = 1, 1
    for j in range(n):
        ans += p * pow(cy, n - j, MOD) * q * pow(x - cx, n - j - 1, MOD) * cx % MOD
        p *= y
        q *= x
        p %= MOD
        q %= MOD
    res += ans << i
print(res % MOD)
0