#C10248. Array Transformation with Bitwise OR Operations

    ID: 39432 Type: Default 1000ms 256MiB

Array Transformation with Bitwise OR Operations

Array Transformation with Bitwise OR Operations

You are given an array \(A\) of \(N\) integers and \(M\) operations. Each operation is represented by a triple \((L, R, X)\). For each operation, you must update every element \(A_i\) for \(L \leq i \leq R\) by performing a bitwise OR with \(X\):

[ A_i = A_i ;|; X \quad \text{for } L \leq i \leq R ]

Your task is to process all the operations in the given order and output the transformed array.

Example:

Input:
5 3
1 2 3 4 5
1 3 2
2 5 4
1 4 1

Output: 3 7 7 5 5

</p>

inputFormat

The first line contains two space-separated integers \(N\) and \(M\) where \(N\) is the number of elements in the array and \(M\) is the number of operations.

The second line contains \(N\) space-separated integers representing the array \(A\).

Each of the next \(M\) lines contains three space-separated integers \(L\), \(R\), and \(X\) representing an operation.

outputFormat

Output the final array after performing all operations. The elements should be printed in a single line separated by spaces.

## sample
5 3
1 2 3 4 5
1 3 2
2 5 4
1 4 1
3 7 7 5 5

</p>