and it's equivalent to checking if the difference between every 2 consecutive elements in range is divisible byd. So, we transform our array to an array of differencesa[i] - a[i - 1]fori > 0; on this array, we need to check ifddivides all elements ...
basically update range with arithmetic progression,apply all queries then print the final array Now depending on the details of the problem this can be solved using prefix sums , segment tree ,or some other way A brief explanation of the segment tree with lazy propagation solution is that in ...
It turns out thatfcan actually be many different functions. Instead of finding a solution, Kevin wants you to count the number of distinct functionsfthat satisfy this equation. Since the answer may be very large, you should print your result modulo109 + 7. Input The input consists of ...