QOJ.ac

QOJ

Time Limit: 2.5 s Memory Limit: 512 MB Total points: 100

#14581. 少年汹涌

الإحصائيات

翻涌 至喷涌
谁能懂 少年汹涌

题目描述

希寇给了你长为 $n$ 的序列 $a$ 和数组 $w$。

对于常数 $L$,定义 $f(x)$ 为如下操作构成的集合:

  1. 将 $x$ 加入集合。
  2. 将 $x \leftarrow x+w_{\mathrm{popcount}(x)}$,其中 $\mathrm{popcount}(x)$ 表示 $x$ 二进制下 $1$ 的个数,若 $x>L$ 结束操作,否则回到第一步。

希寇想知道 $\bigcup\limits_{i=1}^nf(a_i)$ 的大小,你能帮帮他吗?

输入格式

第一行两个正整数 $n,L$。

第二行一个长度为 $62$ 的数组 $w$。

第三行一个长度为 $n$ 的数组 $a$。

输出格式

一个整数表示答案。

输入输出样例 #1

输入 #1

3 246
7 2 1 10 3 9 4 8 5 6 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 
97 112 72

输出 #1

42

说明/提示

对于所有数据,$n\leq 6\times 10^4,1\leq w_i\leq 62,1\leq a_i\leq L$。

子任务 分值 $n\leq$ $L\leq$ 特殊性质
$1$ $3$ $10^3$ $10^4$ A
$2$ $5$ $6\times 10^4$ $2^{30}-1$ A
$3$ $10$ $1$ $2^{60}-1$
$4$ $12$ $10$ $2^{60}-1$
$5$ $15$ $10^2$ $2^{60}-1$
$6$ $24$ $3\times 10^4$ $2^{60}-1$ A
$7$ $31$ $6\times 10^4$ $2^{60}-1$
  • 特殊性质 A:$w_i=i$,$a_i$ 在 $[1,L]$ 中均匀随机。

Discussions

About Discussions

The discussion section is only for posting: Editorials, General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues. Submitting multiple issues may cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.