問題一覧 > 通常問題

No.1410 A lot of Bit Operations

レベル : / AI推定難易度 : 1800 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 29
作問者 : PCTprobability / テスター : akakimidori hotman78
お気に入りにしたユーザー ProblemId : 5600 / 自分の提出
問題文最終更新日: 2021-02-26 22:34:25
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 284 (順位表) の他の問題:

Problem Statement

Fill each of $x,y,z,w$ in the table above with one of $0,1$, and define $S_{x+2y+4z+8w}$ as the operation that applies the table above to each bit of non-negative integers $a,b$. For example, $S_6$ gives $1$ when the bits of $a,b$ differ and $0$ when they are the same, so it is XOR.

You are given a positive integer $N$ and a string $K$ of $8$ characters, each of which is o or -. For each non-negative integer between $0$ and $7$ inclusive such that $K_{i+1}$ is o, call it $i$ and take the following value; output the sum of these values modulo $1000000007$.

The number of triples $(P,Q,R)$ of non-negative integers that are at least $0$ and less than $2^N$ and satisfy $((P$ $S_i$ $Q )-R)×((P$ $S_{15-i}$ $Q) -R) \le 0$. Here, compute each operation with leading zeros inserted so that its result has exactly $N$ digits. (Added at 21:45)

Input

$N$
$K$

  • $N$ is an integer.
  • $K$ is a string whose characters are all o or -.
  • $0 \le N \le 10^{18}$
  • $|K|=8$

Output

Output the value described in the problem statement.

Sample

Sample 1
Input
3
-o------
Output
368

The operation $S_1$ is the NOR operation. The operation $S_{14}$ is equivalent to performing the NOR operation and then the ! operation. For example, $(P,Q,R)=(4,6,4)$ satisfies the condition.

Sample 2
Input
4736175978463
o--o-oo-
Output
942654651

Note the constraint on $N$. Also note that you must find the answer modulo $1000000007$.

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