問題一覧 > 通常問題

No.2058 Binary String

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

You are given positive integers $N,K$. A sequence of length $N$ is called a good sequence if it satisfies the following conditions.

  • For every integer $i$ satisfying $1 \le i \le N $, $ S_i \in \lbrace 0,1 \rbrace$
  • $\displaystyle \sum_{i=1}^N S_i \equiv 0 \ (\mathrm{mod}\ 2)$

For a good sequence $S$, let $f(S)$ be the minimum number of operations required to make all elements of $S$ equal to $0$ by performing the following operation $0$ or more times. (If $S$ is a good sequence, $f(S)$ is a finite value.)

  • Choose one integer $i$ satisfying $1 \le i \le N-1$, replace $S_i$ with $1-S_i$, and replace $S_{i+1}$ with $1-S_{i+1}$.

There are $2^{N-1}$ good sequences $S$. Compute $f(S)$$^K$ for all of them, and find the sum of these values modulo $998244353$.

Input

$N$ $K$

  • $2 \le N \le 2×10^5$
  • $1 \le K \le 2×10^5$
  • All inputs are integers.
  • Output

    Print the sum of $f(S)^K$ modulo $998244353$.

    Sample

    Sample 1
    Input
    3 2
    Output
    6

    We have $f((0,0,0))=0、f((1,1,0))=f((0,1,1))=1、f((1,0,1))=2$. Therefore, the answer is $1^2+1^2+2^2=6$.

    Sample 2
    Input
    10 3
    Output
    62208

    Sample 3
    Input
    200000 2
    Output
    829773566

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