Pro's Dilemma
Time Limit: 2 sec
Memory Limit: 256 MB
Attempts: 80
Accuracy: 5.00%
Author: Hritvi Bhandari
Pro is a painter. He is also pro in sports programming.
He got a contract for painting a wall of a house. The wall is divided into N segments all initially colored with 0. He has to color the segments according to the demands of the family members.
In total, there will be Q demands to color segment [L, R] with color C. These will be sequential, so Pro has to fulfill them in the order given.
Pro is not worried about the demands, however, he is curious about the color of each segment, so he asks for your help.
Constraints :
1 <= N <= 100000
1 <= Q <= 100000
1 <= L <= R <= 100000
1 <= C <= 1000000000
Input:
First-line contains two integers N (number of segments of the wall)
Second-line contains Q (total demands)
Next, Q lines will be having Li, Ri, Ci (segment Li to Ri, has to be colored with color Ci)
Output:
Print a single line with space-separated N integers, representing the color of N segments after all demands are fulfilled.
Sample Test Case 1
Input:
5
2
2 5 777
1 3 34
Output:
34 34 34 777 777
Explanation
After first demand: 0 777 777 777 777
After second demand: 34 34 34 777 777
ID
SUBMITTED AT
STATUS
LANGUAGE
TIME
MEMORY USED
USER
TIME
STATUS
LANGUAGE
TIME
MEMORY USED
1 year ago
java
0.00 sec
0 KB
1 year ago
java
0.21 sec
444 KB
1 year ago
java
0.00 sec
0 KB
1 year ago
cpp14
0.10 sec
9724 KB
1 year ago
cpp14
2.00 sec
8164 KB
1 year ago
cpp
0.00 sec
0 KB
1 year ago
cpp
0.16 sec
6720 KB
1 year ago
cpp
0.17 sec
6720 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp14
0.07 sec
64 KB
1 year ago
cpp14
0.27 sec
13960 KB