Ignatius has just come back school from the 30th ACM/ICPC. Now he has
a lot of homework to do. Every teacher gives him a deadline of handing
in the homework. If Ignatius hands in the homework after the deadline,
the teacher will reduce his score of the 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. Ignatius 刚刚从第 30 届 ACM/ICPC 回到学校。
现在他有很多作业要做。 每个老师都给他规定了交作业的截止日期。 如果
Ignatius 在截止日期后交作业,老师将降低他期末考试的分数。
现在我们假设做每个人的作业总是需要一天的时间。 所以 Ignatius
希望你帮他安排一下做作业的顺序,尽量减少分数的降低。
输入格式:
The input contains several test cases. The first line of the input is
a single integer T that is the number of test cases. T test cases
follow. Each test case start with a positive integer N(1<=N<=1000)
which indicate the number of homework.. Then 2 lines follow. The first
line contains N integers that indicate the deadlines of the subjects,
and the next line contains N integers that indicate the reduced scores.
输入包含多个测试用例。 输入的第一行是一个整数 T,它是测试用例的数量。 T
测试用例如下。 每个测试用例都以正整数 N(1<=N<=1000)
开头,表示作业的数量。然后是 2 行。 第一行包含 N
个整数,表示科目的截止日期,下一行包含 N 个整数,表示减少的分数。
输出格式:
For each test case, you should output the smallest total reduced
score, one line per test case.
对于每个测试用例,您应该输出最小的总降低分数,每个测试用例一行。