結果

問題 No.1952 xooooooooooor
ユーザー ああいいああいい
提出日時 2022-05-20 23:00:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 521 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 81,864 KB
実行使用メモリ 53,500 KB
最終ジャッジ日時 2023-10-20 13:52:40
合計ジャッジ時間 2,970 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,500 KB
testcase_01 AC 42 ms
53,500 KB
testcase_02 AC 38 ms
53,500 KB
testcase_03 AC 38 ms
53,500 KB
testcase_04 AC 39 ms
53,500 KB
testcase_05 AC 38 ms
53,500 KB
testcase_06 AC 38 ms
53,500 KB
testcase_07 AC 39 ms
53,500 KB
testcase_08 AC 38 ms
53,500 KB
testcase_09 AC 38 ms
53,500 KB
testcase_10 AC 38 ms
53,500 KB
testcase_11 AC 38 ms
53,500 KB
testcase_12 AC 38 ms
53,500 KB
testcase_13 AC 40 ms
53,500 KB
testcase_14 AC 39 ms
53,500 KB
testcase_15 AC 40 ms
53,500 KB
testcase_16 AC 39 ms
53,500 KB
testcase_17 AC 38 ms
53,500 KB
testcase_18 AC 38 ms
53,500 KB
testcase_19 AC 39 ms
53,500 KB
testcase_20 AC 38 ms
53,500 KB
testcase_21 AC 38 ms
53,500 KB
testcase_22 AC 39 ms
53,500 KB
testcase_23 AC 39 ms
53,500 KB
testcase_24 AC 38 ms
53,500 KB
testcase_25 AC 39 ms
53,500 KB
testcase_26 AC 38 ms
53,500 KB
testcase_27 AC 38 ms
53,500 KB
testcase_28 AC 39 ms
53,500 KB
testcase_29 AC 39 ms
53,500 KB
testcase_30 AC 39 ms
53,500 KB
testcase_31 AC 39 ms
53,500 KB
testcase_32 AC 39 ms
53,500 KB
testcase_33 AC 38 ms
53,500 KB
testcase_34 AC 38 ms
53,500 KB
testcase_35 AC 39 ms
53,500 KB
testcase_36 AC 39 ms
53,500 KB
testcase_37 AC 38 ms
53,500 KB
testcase_38 AC 38 ms
53,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())

P = 998244353
import sys
if M <= 70:
    ans = 0
    for i in range(M):
        ans ^= N << i
    print(ans % P)
    exit()

if N == 0:
    print(0)
    exit()
if N == 1:
    ans = pow(2,M,P) - 1
    print(ans % P)
    exit()

k = len(bin(N)) - 2
a = 0
for i in range(k):
    a ^= N << i
a &= (1 << (k-1)) - 1
b = 0
for i in range(k):
    b ^= N >> i
b &= (1 << k) - 1
b >>= 1
t = bin(N).count('1') % 2
ans = b * pow(2,M,P) + t * pow(2,k-1,P) * (pow(2,M + 1 - k,P) - 1) + a
print(ans % P)
0