2020新生赛报名网站，请先注册登录xdoj以后再通过下方网站报名 http://acm.xidian.edu.cn/signuppage.php

[提交][状态][讨论版]

题目描述

Orz Panda is addicted to one RPG game. To make his character stronger, he have to fulfil tasks to get EXP for higher level.At first he accepted all the tasks.But after he read rules carefully, he realized that what he has done was stupid.
Rule:
Every task costs 1 time interval.
Every task has a dead line.If you can't finish it on time ,you have to pay the same amount of gold as the EXP given by this task.

Orz Panda wants to know the minimum amount of gold he has to pay.

输入

The first line has one integer n, tell you how many tasks Orz Panda has accepted.
The second line has n integers ti separated by blank, represent for the ith task's dead line.
The third line has n integers ei separated by blank, represent for the
EXP given by the ith task.
（1 <= n, ti, ei <= 1000）

输出

One integer for the minimum amount of gold Orz Panda has to pay.

```4
3 1 2 3
10 20 30 40
```

```10
```

[提交][状态][讨论版]