#K86087. Maximum Fireworks Beauty Calculation
Maximum Fireworks Beauty Calculation
Maximum Fireworks Beauty Calculation
You are given a fireworks display challenge. In each test case, you are provided with a list of fireworks. Each firework has a burst duration and a beauty value. Since the fireworks can be fired sequentially without overlap, the maximum achievable beauty for a given test case is simply the sum of the beauty values of all the fireworks.
The input starts with an integer \(T\) indicating the number of test cases. For each test case, you will first receive an integer \(N\) representing the number of fireworks, followed by a line with \(N\) space-separated integers corresponding to the burst durations \(D_i\), and then another line with \(N\) space-separated integers corresponding to the beauty values \(B_i\). Your task is to compute and print the total beauty for each test case.
Note: All input should be read from standard input (stdin) and the output should be written to standard output (stdout).
inputFormat
The first line contains an integer \(T\) (1 \(\leq T \leq\) 1000) representing the number of test cases.
- For each test case:
- The first line contains an integer \(N\), the number of fireworks.
- The second line contains \(N\) space-separated integers \(D_i\) representing the burst durations.
- The third line contains \(N\) space-separated integers \(B_i\) representing the beauty values.
outputFormat
For each test case, print a single line containing one integer: the maximum beauty value, which is the sum of all beauty values \(B_i\) for that test case.
## sample3
3
3 1 2
5 10 7
4
4 2 5 1
1 5 3 9
2
2 2
8 6
22
18
14
</p>