H
Hugo Gil
Guest
AND Operation
You are given an array A of length N and Q tasks.
Each task is of the following type:
L R V: Apply the bitwise-and operator with V for all A, where L <= i <= R.
You need to print the array after perfoming all the task.
Input format:
- First line: Two integers, N length of array, and Q number of tasks.
- Second line: N space.separated elemets of the array.
- Each of the following Q lines contains a task in the described format.
Output format:
- Print the final arrays after performing all the Q tasks.
Constraints:
1 <= N <= 10 (potency 5)
1 <= Q <= 2*10 (potency 5)
1 <= Ai, V <= 10 (potency 9)
1 <= L <= R <= N
Sample input:
5 2
7 7 7 7 7
1 3 4
1 5 6
Sample Output:
4 4 4 6 6
Explanation:
After first task, the array will be 4,4,4,7,7
After second task, the array will be 4,4,4,6,6
the problem as such, this exercise is supposed to happen to javascript or c #. and I do not know what to put in the code since I do not understand the problem
Thanks
Hugo Gil
Continue reading...
You are given an array A of length N and Q tasks.
Each task is of the following type:
L R V: Apply the bitwise-and operator with V for all A, where L <= i <= R.
You need to print the array after perfoming all the task.
Input format:
- First line: Two integers, N length of array, and Q number of tasks.
- Second line: N space.separated elemets of the array.
- Each of the following Q lines contains a task in the described format.
Output format:
- Print the final arrays after performing all the Q tasks.
Constraints:
1 <= N <= 10 (potency 5)
1 <= Q <= 2*10 (potency 5)
1 <= Ai, V <= 10 (potency 9)
1 <= L <= R <= N
Sample input:
5 2
7 7 7 7 7
1 3 4
1 5 6
Sample Output:
4 4 4 6 6
Explanation:
After first task, the array will be 4,4,4,7,7
After second task, the array will be 4,4,4,6,6
the problem as such, this exercise is supposed to happen to javascript or c #. and I do not know what to put in the code since I do not understand the problem
Thanks
Hugo Gil
Continue reading...