First, how can we say that an array is a permutation?
Suppose array length is , then sum of the permutation should be , minimum value of permutation is , maximum value of permutation is . Is that enough? No, we can also check the sum of the permutation. So, if an array holds these 4 conditions we can say that this array holds a permutation.
Now, how can we solve for the range of an array? We can maintain range xor, range sum, range minimum, range maximum using data structure. Now How can we solve the update part? Update only for an index at a time. So we can update in O(log(n)) time and overall complexity is O(n+qlog(n)).