Medium Data Structures > Basic Data Structures

**Dev Point (DP)** is the currency of **Dev Skill**. A user can earn **DP** by contributing in Dev Skill: - Signing Up on Dev Skill (**500DP**) - Logging in the website. (**10DP** for login once everyday) - Report bug in feedback. (**50DP**) - Contributing Problem (**200DP** for each contribution) <br></br> Now here is a simple problem for you. Suppose, there are **N** user in Dev Skill. They have some initial DP. Dev SKill have **M** offers. Each offers will gift a certain amount of DP to users. There are also **Q** operations. Each operation is denoted by **X Y L R** : Applying all offers indexed between **X** to **Y (1 ≤ X ≤ Y ≤ M)** to all users indexed between **L** to **R (1 ≤ L ≤ R ≤ N).** You have to find the DP(Dev Point) of all users after performing all operations. Input: ------ Input starts with an integer **T (1 ≤ T ≤ 5)**, denoting the number of test cases. Each case contains three integers **N, M, Q (1 ≤ N, M, Q ≤ 100000)** denoting the number of users in Dev Skill, the number of offers and the number of operations respectfully. The next line will contain **N** integers separated by spaces, denoting the Dev Point of users. The ith integers denotes the Dev Point of ith user. **(1 ≤ i ≤ N, 1 ≤ DevPont[i] ≤ 100000)**. The next line will contain **M** integers separated by spaces, denoting the offeres. The ith integers denotes the Dev Point of ith offer. **(1 ≤ i ≤ M, 1 ≤ Offer[i] ≤ 100000)**. The next **Q** lines will denote the operations. Each line will contain four integers **X, Y, L** and **R**. Perform each operation as described above. Output: ------- For each case, in the first line, print the test case number formatted by **"Case tc:"**, where **tc** is the test case number. In the next line, print the final Dev Point of all users separated by spaces, be sure to avoid extra space. Sample Input ------------ 2 4 3 1 1 2 3 4 2 3 1 1 3 1 4 2 2 1 5 4 3 4 2 2 1 2 Sample Output ------------- Case 1: 7 8 9 10 Case 2: 9 8

Emrul Chowdhury