結果

問題 No.1952 xooooooooooor
ユーザー rlangevinrlangevin
提出日時 2023-06-09 00:28:40
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 523 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 87,408 KB
実行使用メモリ 81,368 KB
最終ジャッジ日時 2023-08-30 02:36:27
合計ジャッジ時間 5,659 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

N, M = map(int, input().split())
mod = 998244353
ans = 0
if M <= 100:
    for i in range(M):
        ans ^= N << i
    print(ans%mod)
    exit()
    
if N == 0:
    print(0)
    exit()
    
K = 0
temp = N
while temp:
    temp //= 2
    K += 1
keta = M - K - 1

up, down, all = 0, 0, 0
for i in range(N):
    up ^= (N >> i)
    down ^= (N << i) % (1 << K)
    all ^= (N >> i) & 1
    
middle = 0
if all:
    middle = pow(2, keta, mod) - 1
    
ans = down + middle * pow(2, K, mod) + up * pow(2, K + keta, mod)
print(ans%mod)
0