The Challenge Day

All submissions for this problem are available.
### Read problems statements in [Hindi](http://www.codechef.com/download/translated/COOK112/hindi/CHADAY.pdf), [Mandarin Chinese](http://www.codechef.com/download/translated/COOK112/mandarin/CHADAY.pdf), [Russian](http://www.codechef.com/download/translated/COOK112/russian/CHADAY.pdf), [Vietnamese](http://www.codechef.com/download/translated/COOK112/vietnamese/CHADAY.pdf), and [Bengali](http://www.codechef.com/download/translated/COOK112/bengali/CHADAY.pdf) as well. It is the end of 2019 — the 17th of November, the Cooking Challenge day. There are $N$ players participating in this competition, numbered $1$ through $N$. Initially, the skill level of each player is zero. There are also $M$ challenges (numbered $1$ through $M$). For each valid $i$, the $i$th challenge has three parameters $L_i$, $R_i$ and $X_i$ with the following meaning: for each player between the $L_i$th and $R_i$th inclusive, if this player participates in this challenge, their skill level increases by $X_i$ ($X_i$ does not have to be positive). The organizers of the Cooking Challenge decided that the contest would be boring if they let the participants participate in the challenges directly, so they decided to use the *compos*. There are $Q$ compos (numbered $1$ through $Q$). For each valid $i$, the $i$th compo has two parameters $A_i$ and $B_i$, which means that it includes the challenges $A_i, A_i+1, \ldots, B_i$. Each participant has to select a subset of the compos (possibly empty or the set of all $Q$ compos) and participate in all challenges those compos include. A participant may not select the same compo twice, but may participate in the same challenge more than once if it is included in multiple chosen compos. For each player, find the maximum skill level this player can reach if the compos are chosen optimally. ### Input  The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.  The first line of each test case contains three spaceseparated integers $N$, $M$ and $Q$.  $M$ lines follow. For each valid $i$, the $i$th of these lines contains three spaceseparated integers $L_i$, $R_i$ and $X_i$.  $Q$ more lines follow. For each valid $i$, the $i$th of these lines contains two spaceseparated integers $A_i$ and $B_i$. ### Output For each test case, print a single line containing $N$ spaceseparated integers. For each valid $i$, the $i$th of these integers should denote the maximum skill level of the $i$th player. ### Constraints  $1 \le T \le 1,000$  $1 \le N \le 100,000$  $1 \le M \le 1,000$  $1 \le Q \le 10,000$  $1 \le L_i \le R_i \le N$ for each valid $i$  $1 \le A_i \le B_i \le M$ for each valid $i$  $X_i \le 1,000,000$ for each valid $i$  the sum of $N$ over all test cases does not exceed $1,000,000$  the sum of $M$ over all test cases does not exceed $5,000$  the sum of $Q$ over all test cases does not exceed $50,000$ ### Example Input ``` 1 5 3 4 1 1 3 1 2 4 4 5 2 1 2 1 3 1 1 2 3 ``` ### Example Output ``` 3 0 0 4 4 ``` ### Explanation **Example case 1:**  The first player will select the $3$rd compo.  The second and third players will not select any compo.  The fourth player will select the $1$st, $2$nd and $4$th compos.  The fifth player will select all the compos.Author:  mhammad1 
Editorial  https://discuss.codechef.com/problems/CHADAY 
Tags  cook112, datastructure, easymedium, mhammad1, taran_1407 
Date Added:  14112019 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 