Mr. Purple has a class of
Known for his leniency during tests, Mr. Purple often does not watch the students, allowing them to sneakily google the answers on their phones. Unfortunately (for the students), he has a scheme in place to prevent cheating. For the
Thankfully, after some clever social engineering from one of the brightest students (you), all the weights of the questions and Mr. Purple's estimations have been uncovered. Now, the night before the test, the class has agreed their strategy will be the following:
Going through the test in order, for the
Your goal is to determine what the scores of each of the students will be on the test.
Constraints
Subtask 1 [20%]
Subtask 2 [80%]
No additional constraints.
Input Specification
The first line of input contains two integers
The second line of input contains
The third line of input contains
Output Specification
Output
It is possible for these values to exceed the limits of a 32-bit integer. It is advised to use 64-bit integers instead, meaning that Java users should use long
, and C++ users should use long long
.
Sample Input 1
3 2
1 2 3
1 2 2
Sample Output 1
6 5
Explanation for Sample 1
Initially, the scores are
The first problem will be solved by only student #1. Hence, the scores will become
Both the second and third problem will be solved by both students. Thus, the final scores will be
Sample Input 2
5 6
1 2 2 7 8
3 1 4 1 5
Sample Output 2
11 11 8 10 10 10
Comments