Modulo

Limits 4s, 512 MB

Let’s get straight into the problem. In ths problem, here will be multiple test cases. In each test case you will be given an array A[] of N integers. Then there will be Q queries. In each query You will be given an integer M. For every i where 1<=i<=N you have to change A[i] to A[i] mod M. After executing all queries you have to print the array A[] in the order of input.


This is a companion discussion topic for the original entry at https://toph.co/p/modulo