問題一覧 > 通常問題

No.2489 X and Xor 2

レベル : / AI推定難易度 : 2500 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 10
作問者 : ytqm3 / テスター : Cyanmond
お気に入りにしたユーザー ProblemId : 10117 / 自分の提出
問題文最終更新日: 2023-09-29 22:49:10
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 406 技術室奥プログラミングコンテスト#7 Day2 (順位表) の他の問題:
The expected solution contained an error, so a rejudge was performed. We apologize to those affected.

Problem Statement

Find the sum of the following value over all sequences $A=(A_1,A_2,\ldots,A_N)$ of length $N$ consisting of integers at least $0$ and less than $M$, modulo $998244353$.

  • $(A_1 \oplus A_2) \times (A_2 \oplus A_3) \times \ldots \times (A_{N-1} \oplus A_N)$

Here, $a \oplus b$ denotes the $\mathrm{bit}$wise exclusive OR of $a$ and $b$.

Input

$N$ $M$
  • $2 \le N \le 10^{18}$
  • $1 \le M \le 10^{18}$
  • All input values are integers.

Output

Output the answer.

Sample

Sample 1
Input
2 2
Output
2
Sample 2
Input
2 1
Output
0
Sample 3
Input
314 159
Output
314977317

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。