[Ynoi2079] r2pspc

Luogu
IDLGP9986
Time2000ms
Memory512MB
DifficultyP7
O2优化Ynoi2079
给定序列 $a_1,\dots,a_n$,共 $m$ 次查询,每次查询问 $\sum\limits_{i=l}^r 2^{a_i}$ 的二进制表示中 $1$ 的个数。 ## Input 第一行两个数表示 $n,m$。 第二行 $n$ 个数表示 $a_1,\dots,a_n$。 接下来 $m$ 行每行 $l,r$ 表示一次查询。 ## Output 共 $m$ 行,依次为每次查询的答案。 [samples] ## Note Idea:rushcheyo,Solution:djq_cpp&ccz181078,Code:ccz181078,Data:ccz181078 对于 $100\%$ 的数据,满足 $1\le n\le {10}^5$,$1\le m\le {10}^6$,$1\le a_i\le 10^9$,$1\le l\le r\le n$。 对于 $25\%$ 的数据,满足 $n,m\le 1000$。 对于另外 $25\%$ 的数据,满足 $a_i\le100$。 对于另外 $25\%$ 的数据,满足 $m\le 10^5$ 对于另外 $25\%$ 的数据,无特殊限制。
Samples
Input #1
5 2
2 3 1 2 32
2 5
2 5
Output #1
4
4
API Response (JSON)
{
  "problem": {
    "name": "[Ynoi2079] r2pspc",
    "description": {
      "content": "给定序列 $a_1,\\dots,a_n$,共 $m$ 次查询,每次查询问 $\\sum\\limits_{i=l}^r 2^{a_i}$ 的二进制表示中 $1$ 的个数。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P7"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGP9986"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "给定序列 $a_1,\\dots,a_n$,共 $m$ 次查询,每次查询问 $\\sum\\limits_{i=l}^r 2^{a_i}$ 的二进制表示中 $1$ 的个数。\n\n## Input\n\n第一行两个数表示 $n,m$。\n\n第二行 $n$ 个数表示 $a_1,\\dots,a_n$。\n\n接下来 $m$ 行每行 $l,r$ 表示一次查询。\n\n## Output\n\n共 $m$ 行,依次为每次查询的答案。...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments