#P11894. 「LAOI-9」Update

「LAOI-9」Update

Problem Description

Given a sequence aa of length nn, there are mm operations. Each operation is as follows:

  • Given l,rl, r, for i[l,r]i \in [l, r], set aiai+log2aia_i \leftarrow a_i + \lfloor \log_2 a_i \rfloor.

After all mm operations, output the sequence aa.

Input Format

The first line contains two positive integers nn and mm.

The next line contains nn positive integers, where the ii-th number is aia_i.

The next mm lines each contain two positive integers ll and rr.

Output Format

Output one line with nn positive integers, where the ii-th number is aia_i. Adjacent integers are separated by spaces.

5 2
2 3 4 5 6
2 3
1 1
3 4 6 5 6

Hint

This problem uses bundled testdata.

Subtask ID n,mn, m \le Special Property Score
11 10310^3 None 3030
22 10510^5 A 2020
33 None 5050

Special property A: ai100a_i \le 100.

For 100%100\% of the testdata, 1n,m1051 \le n, m \le 10^5, 1ai1051 \le a_i \le 10^5, and 1lrn1 \le l \le r \le n.

Translated by ChatGPT 5