fork download
  1. def And_Queries(N, Q, arr, tasks):
  2. for task in tasks:
  3. L, R, V = task[0], task[1], task[2]
  4. for i in range(L - 1, R):
  5. arr[i] &= V
  6. return arr
  7.  
  8. N = 5
  9. Q = 2
  10. arr = [7, 7, 7, 7, 7]
  11. tasks = [[1, 3, 4], [1, 5, 6]] # Corrected the second task, removed extra brackets
  12.  
  13. print(And_Queries(N, Q, arr, tasks))
  14.  
  15.  
  16.  
  17.  
Success #stdin #stdout 0.03s 9476KB
stdin
Standard input is empty
stdout
[4, 4, 4, 6, 6]