結果

問題 No.1952 xooooooooooor
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2022-05-20 22:05:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 871 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 81,608 KB
実行使用メモリ 55,520 KB
最終ジャッジ日時 2023-10-20 12:45:33
合計ジャッジ時間 3,085 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

"""

"""

import sys
from sys import stdin
from collections import deque
import heapq

def popcnt(X):

    ret = 0
    while X:
        ret += X % 2
        X //= 2
    return ret % 2

N,M = map(int,stdin.readline().split())
NR = N.bit_length()

mod = 998244353

if M <= 70:
    ans = 0
    for i in range(M):
        ans ^= N
        N *= 2
    print (ans % mod)

else:

    minbit = 0
    NN = N
    for i in range(70):
        minbit ^= NN
        NN *= 2

    maxbit = 0
    NN = N
    for i in range(70):
        maxbit ^= NN
        NN //= 2

    ans = 0
    cnt = popcnt(N)
    if cnt == 0:
        pass
    else:
        ans += ( pow(2,M-NR+1,mod)-1 ) * pow(2,NR-1,mod)
        ans %= mod

    for i in range(NR-1):
        ans += minbit & (2**i)

    
    for i in range(1,NR):
        ans += (maxbit & (2**i)) * pow(2,M-1,mod)

    ans %= mod

    print (ans)
0