問題一覧 > 通常問題

No.2060 AND Sequence

レベル : / AI推定難易度 : 1550 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 90
作問者 : taiga0629kyopro / テスター : chineristAC nok0 ygussany
お気に入りにしたユーザー ProblemId : 8320 / 自分の提出
問題文最終更新日: 2022-08-26 20:53:05
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 358 (順位表) の他の問題:

Problem Statement

Find the number of sequences $A$ of non-negative integers of length $N$ that satisfy the following conditions. ($\mathrm{AND}$ denotes the bitwise logical AND.)

  • $0 \le A_i \le M (1 \le i \le N) $
  • $A_i$ $\mathrm{AND}$ $A_{i+1} =A_i (1 \le i \le N-1)$
Since the answer can be very large, output it modulo $998244353$.

Input

$N$ $M$

  • $2 \le N \le 2×10^5 $
  • $1 \le M < 2^{30} $
  • All inputs are integers.
  • Output

    Output the number of sequences $A$ satisfying the conditions, modulo $998244353$.

    Sample

    Sample 1
    Input
    3 3
    Output
    16

    For example, $A=(0,1,3)$ satisfies the conditions.

    Sample 2
    Input
    6 29
    Output
    7735

    Sample 3
    Input
    100000 1000000000
    Output
    808693061

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