「UOI-R1」询问

Luogu
IDLGP8891
Time2000ms
Memory512MB
DifficultyP1
模拟O2优化
给定 $n$ 个数的整数序列 $a_1, a_2, \cdots, a_n$,有 $m$ 次操作,每次操作给定 $x, y$,你需要找到所有 $i$,满足 $i \oplus x = 0$,然后 $a_i \gets a_i - y$。如果没有任何一个这样的 $i$,则序列什么也不会更改。这里的 $\oplus$ 为按位异或操作。 操作结束后,你需要输出这个序列。 ## Input 第一行,两个正整数 $n,m$,表示序列长度和操作次数。 接下来一行,表示初始序列。 接下来 $m$ 行,每行两个数 $x,y$,意思如题面所示。 ## Output 输出一行,$n$ 个数,表示操作结束后的序列。 [samples] ## Background ZSS 有一个序列,但他实在不太聪明,以至于一个操作问题都要来问你了。 ## Note 对于 $20\%$ 的数据,保证 $1 \leq n, m \leq 10^3$。 对于另外 $20\%$ 的数据,保证 $x=0$。 对于 $100\%$ 的数据,保证 $1 \leq n, m \leq 10^6$,$-10^8 \leq y, a_i \leq 10^{8}$,$0 \leq x \leq n$。
Samples
Input #1
6 1
1 1 4 5 1 1
0 7
Output #1
1 1 4 5 1 1
Input #2
3 1
0 3 9
1 2
Output #2
-2 3 9
Input #3
见文件附件的 queries3.in
Output #3
见文件附件的 queries3.ans
Input #4
见文件附件的 queries4.in
Output #4
见文件附件的 queries4.ans
API Response (JSON)
{
  "problem": {
    "name": "「UOI-R1」询问",
    "description": {
      "content": "给定 $n$ 个数的整数序列 $a_1, a_2, \\cdots, a_n$,有 $m$ 次操作,每次操作给定 $x, y$,你需要找到所有 $i$,满足 $i \\oplus x = 0$,然后 $a_i \\gets a_i - y$。如果没有任何一个这样的 $i$,则序列什么也不会更改。这里的 $\\oplus$ 为按位异或操作。 操作结束后,你需要输出这个序列。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P1"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGP8891"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "给定 $n$ 个数的整数序列 $a_1, a_2, \\cdots, a_n$,有 $m$ 次操作,每次操作给定 $x, y$,你需要找到所有 $i$,满足 $i \\oplus x = 0$,然后 $a_i \\gets a_i - y$。如果没有任何一个这样的 $i$,则序列什么也不会更改。这里的 $\\oplus$ 为按位异或操作。\n\n操作结束后,你需要输出这个序列。\n\n## Input\n\n第一行,...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments