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]$ 中均匀随机。
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.