Doing Homework again
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 11806 Accepted Submission(s): 6948
Problem Description
Ignatius has just come back school fromthe30th ACM/ICPC. Now he has a lot of homework todo. Every teacher gives him a deadline of handing inthe homework. If Ignatius hands inthe homework afterthe deadline, the teacher will reduce his score ofthe final test. And now we assume that doing everyone homework always takes one day. So Ignatius wants you to help him to arrange the order of doing homework to minimize the reduced score.
Input
The input contains several test cases. The firstlineofthe input is a single integer T that is thenumberof test cases. T test cases follow.
Each test case start witha positive integer N(1<=N<=1000) which indicate thenumberof homework.. Then 2lines follow. The firstlinecontains N integers that indicate the deadlines ofthe subjects, andthe next linecontains N integers that indicate the reduced scores.
Output
For each test case, you should output the smallest total reduced score, oneline per test case.
Sample Input
3333310513131623714642433217654
Sample Output
035
Doing Homework againTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 11806 Accepted Submission(s): 6948Problem DescriptionIgnatius has just