| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 3 초 (추가 시간 없음) | 1024 MB | 5 | 1 | 1 | 25.000% |
Askhat is a prospective businessman. He quickly figured that programming is an unprofitable business, so he decided to open a chicken farm.
His farm consists of $n$ chickens ordered in a row. The $i$-th chicken can eat at most $a_i$ grains. There are $m$ feeders, each described by integers $l_j,ドル $r_j,ドル $c_j$. The $j$-th feeder can feed the $i$-th chicken if $l_j \le i \le r_j,ドル and there are $c_j$ grains in this feeder.
Turns out that every business has its own pitfalls, in this case it has the face of chicken feeding control, represented by Ildar. He claims that every respectable chicken farm must have a chicken representative. That is, there must exist a chicken $i$ such that $l_j \le i \le r_j$ holds for every feeder $j$. All feeders that don't obey this rule must be exterminated.
Now Askhat asks you to find, for each $i,ドル what is the maximum number of grains that can be fed to chickens if we leave only feeders that can feed chicken $i$.
The first line contains a single integer $t$ (1ドル \leq t \leq 10^4$) --- the number of test cases. Description of test cases follows.
The first line of each test case contains two integers $n,ドル $m$ (1ドル \le n, m \le 10^5$) --- the number of chickens and the number of feeders respectively.
The next line contains $n$ integers $a_1, a_2, \ldots, a_n$ (0ドル \le a_i \le 10^9$) --- the number of grains that chickens can eat.
Each of the next $m$ lines contains three integers $l_j,ドル $r_j,ドル $c_j$ (1ドル \le l_j \le r_j \le n,ドル 0ドル \le c_j \le 10^9$) --- description of the $j$-th feeder.
It is guaranteed that both the sum of $n$ and the sum of $m$ for all test cases do not exceed 10ドル^5$.
For each test case, print $n$ integers --- the answer to the problem.
1 4 3 3 3 2 2 1 2 2 3 3 3 2 2 4
2 5 2 0