time limit per test 2 second memory limit per test 256 megabytes
Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.
Not all of sellers are honest, so now some products could be more expensive than after a week of discounts.
Igor decided that buy at least k of items now, but wait with the rest of the week in order to save money as much as possible. Your task is to determine the minimum money that Igor can spend to buy all n items.
In the first line there are two positive integer numbers n and k (1≤n≤2·105, 0≤k≤n) — total number of items to buy and minimal number of items Igor wants to by right now. The second line contains sequence of integers a1,a2,...,an (1≤ai≤104) — prices of items during discounts (i.e. right now). The third line contains sequence of integers b1,b2,...,bn (1≤bi≤104) — prices of items after discounts (i.e. after a week).
Print the minimal amount of money Igor will spend to buy all n items. Remember, he should buy at least k items right now.
简单贪心 降价减去未降价的，从大到小排 cf结算时RE了，很尴尬，发现了一个从未注意过的Java比较器的问题，另一篇文章会讲## AC code:(不包含输入类)