問題一覧 > 通常問題

No.2279 OR Insertion

レベル : / AI推定難易度 : 1825 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 81
作問者 : magsta / テスター : miscalc
お気に入りにしたユーザー ProblemId : 9188 / 自分の提出
問題文最終更新日: 2023-04-20 09:34:47
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 385 (順位表) の他の問題:

Problem Statement

You are given a string $S$ of length $N$ consisting only of 0 and 1.

Consider splitting $S$ into $1$ or more strings. Specifically, there are $N-1$ gaps between adjacent characters of $S$; choose $0$ or more of them, and split at all the chosen gaps. There are $\displaystyle 2^{N-1}$ ways to split. For each way of splitting, compute the value described below, and find the sum of these values modulo $998244353$.

  • The bitwise OR of the resulting strings, each regarded as a base-$2$ integer

Input

$N$
$S$

  • $1 \leq N \leq 4000$
  • $S$ is a string of length $N$ consisting of 0 and 1
  • $N$ is an integer

Output

Output the computed value, followed by a newline.

Sample

Sample 1
Input
3
110
Output
13

There are $4$ ways to split: $\{110\}, \{1,10\}, \{11,0\}, \{1,1,0\}$. Their respective bitwise ORs are as follows. (Shown in base-$10$ notation.)

$\{110\}→6, \{1,10\}→3, \{11,0\}→3, \{1,1,0\}→1$

Therefore, the sum is $13$.

Sample 2
Input
30
011100101010100001110100101010
Output
625160010

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