P25500 [AtCoder] [ABC037B] Editing
入门
题目描述

Problem Description

There is a sequence of length $ N $ denoted as $\{a_i\}$. Initially, all elements of this sequence are $ 0 $.

For this sequence, perform the following operation $ Q $ times in the order given by the input:

  • Replace the elements from the $ L_i $-th to the $ R_i $-th (inclusive) with $ T_i $. Note that the first element of the sequence is the $ 1 $-st element.

Determine the final values of each element in the sequence.

Input Format

The input is given from the standard input in the following format:

$ N $ $ Q $ $ L_1 $ $ R_1 $ $ T_1 $ : $ L_Q $ $ R_Q $ $ T_Q $

Output Format

The output consists of $ N $ lines. On the $ i $-th line, output the value of $ a_i $ after the operations.

Sample Input and Output

Sample Input #1

5 2
1 3 10
2 4 20

Sample Output #1

10
20
20
20
0

Sample Input #2

10 4
2 7 22
3 5 4
6 10 1
4 4 12

Sample Output #2

0
22
4
12
4
1
1
1
1
1

Notes/Hints

Constraints

  • $1 \leq N \leq 100$
  • $1 \leq Q \leq 100$
  • $1 \leq L_i \leq R_i \leq N$
  • $1 \leq T_i \leq 10^9$
  • $ T_i $ is an integer.

Sample Explanation 1

Initially, the sequence is $\{0, 0, 0, 0, 0\}$. After the first operation, the sequence becomes $\{10, 10, 10, 0, 0\}$. After the second operation, the sequence becomes $\{10, 20, 20, 20, 0\}$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
5 2 1 3 10 2 4 20
样例输出
10 20 20 20 0