Problem list
Log in
#r03224 · Online Judge > GoldOJ

Fill the Buckets

Bronze III 2.0 s 1024 MB

There are $N$ buckets (1-indexed), all starting at $0$. Apply $M$ operations, each i j v which sets every bucket in positions $[i, j]$ to $v$ (overwriting). Print the final bucket values, space-separated.

Input

Line 1: $N$ $M$. Next $M$ lines: i j v ($1 \le i \le j \le N$).

Output

Print the final $N$ bucket values.

Example 1

Input
5 4
1 2 3
3 4 4
1 4 1
2 2 2
Output
1 2 1 1 0
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code