[Ynoi Easy Round 2023] TEST_69

Luogu
IDLGP9989
Time2000ms
Memory512MB
DifficultyP6
2023O2优化Ynoi
给定一个长为 $n$ 的序列 $a$,有 $m$ 次操作。 每次有两种操作: ``1 l r x``:对于区间 $[l,r]$ 内所有 $i$,将 $a_i$ 变成 $\gcd(a_i,x)$。 ``2 l r``:查询区间 $[l,r]$ 的和,答案对 $2^{32}$ 取模后输出。 ## Input 第一行两个数 $n,m$。 第二行 $n$ 个数表示 $a_i$。 之后 $m$ 行,每行三个或四个数,表示一次操作。 ## Output 对每个 $2$ 操作,输出一行一个数表示这次查询的答案。 [samples] ## Note Idea:nzhtl1477,Solution:nhtl1477,Code:ccz181078,Data:ccz181078 对于 $20\%$ 的数据,满足 $1 \le n,m,a_i,x \le 10^3$。 对于 $50\%$ 的数据,满足 $1 \le n,m \le 10^5$,且 $a$ 中的元素与每次操作的 $x$ 均随机生成。 对于另外 $20\%$ 的数据,满足所有的查询均在修改后发生。 对于 $100\%$ 的数据,满足 $1\le n\le 2\cdot 10^5,1\le m\le 5 \cdot 10^5$,所有数值为 $[1,10^{18}]$ 内的整数。
Samples
Input #1
10 10
4 1 5 10 1 3 8 2 8 2 
2 1 7
2 1 10
1 7 10 4
1 5 8 10
2 1 8
1 3 5 2
1 3 4 3
2 5 8
2 3 7
2 6 10
Output #1
32
44
26
6
6
11
API Response (JSON)
{
  "problem": {
    "name": "[Ynoi Easy Round 2023] TEST_69",
    "description": {
      "content": "给定一个长为 $n$ 的序列 $a$,有 $m$ 次操作。 每次有两种操作: ``1 l r x``:对于区间 $[l,r]$ 内所有 $i$,将 $a_i$ 变成 $\\gcd(a_i,x)$。 ``2 l r``:查询区间 $[l,r]$ 的和,答案对 $2^{32}$ 取模后输出。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P6"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGP9989"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "给定一个长为 $n$ 的序列 $a$,有 $m$ 次操作。\n\n每次有两种操作:\n\n``1 l r x``:对于区间 $[l,r]$ 内所有 $i$,将 $a_i$ 变成 $\\gcd(a_i,x)$。\n\n``2 l r``:查询区间 $[l,r]$ 的和,答案对 $2^{32}$ 取模后输出。\n\n## Input\n\n第一行两个数 $n,m$。\n\n第二行 $n$ 个数表示 $a_i$。\n\n之后 $m$...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments