結果
| 問題 |
No.1952 xooooooooooor
|
| コンテスト | |
| ユーザー |
とりゐ
|
| 提出日時 | 2022-05-20 22:52:28 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 42 ms / 2,000 ms |
| コード長 | 489 bytes |
| コンパイル時間 | 275 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 52,736 KB |
| 最終ジャッジ日時 | 2024-09-20 09:13:36 |
| 合計ジャッジ時間 | 2,853 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 39 |
ソースコード
mod=998244353
n,m=map(int,input().split())
s=bin(n)[2:]
if m<100:
ans=0
for i in range(m):
ans^=n<<i
print(ans%mod)
exit()
ans=0
ns=len(s)
for i in range(40):
cnt=0
for j in range(max(0,ns-i-1),ns):
cnt+=(s[j]=='1')
if cnt%2==1:
ans+=pow(2,i,mod)
for i in range(40):
cnt=0
for j in range(min(ns,i+1)):
cnt+=(s[j]=='1')
if cnt%2==1:
ans+=pow(2,ns+m-i-2,mod)
if s.count('1')%2==1:
ans+=pow(2,ns+m-41,mod)-pow(2,40,mod)
ans%=mod
print(ans%mod)
とりゐ