Two Much

0

0 votes
Medium
Problem

We are out of plots for the questions.So, let's get to the point of what is asked.

There is an array, A of N elements whose values are initialized to 1. Now, you are given Q queries where each query has two values L and R which denote the index range between which the values are updated by multiplying each of them by 21, 2, 23 ,24 , .... ,2 R - L + 1  serially  i.e; AL = AL x 2 ,  AL+1 = AL+1 x 22    , AL+2 = AL+2 x 23  and so on till AR = AR x 2R-L+1 

Output the final array.

As the values can be large find the values MOD 1000003.

Input Format:

First line contains two integers N and Q. Each of next Q lines contains two integers L and R, denoting the left and right index ( inclusive)  between which update is done.

Output Format:

Output N integers ith  of which denotes the value, Ai

Constraints:

1 <= NQ <= 105                                

1 <= L <= R <= N

Sample Input
5 3
1 3
4 5
1 2
Sample Output
4 16 8 2 4 
Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?