A few guidelines first:
Coming to your problem, (I am assuming you know how to calculate time complexity of your code, if not, learn it first).
The two nested
for-loops make your solution O(t * maxX * n). as maxX can be upto 109, n upto 105 and t upto 10, your solution can take upto 1015 calculations. Given that codechef allows roughly 108 calcluations per second, calculate how much time your solution will take to finish.
P.S. Allowed time limit for each problem is mentioned in the bottom (along with tags, author details and other meta data).
You may try to optimize your solution, or look at the editorial provided at the end of problem page.