Under construction

Still being built. Things may change

Best Chance

Interview

Time limit1sMemory limit1024 MB

Summary
Given each item's profit and price, print each item's net profit, which equals its profit minus the largest profit among all other items.
Level

Easy3 of 10

Topics
Math, Implementation
Solved
No attempts yet

문제

Seungjung likes buying things. He bought banana milk because he wanted to raise a cat, and a Samdasu Buds case because he wanted to draw. Looking back, he has made many purchases he regrets, so he has studied how to spend money wisely. Now he wants to buy items so that his net profit is as large as possible.

To find the net profit of an item, you first need its opportunity cost. The opportunity cost of an item is the largest profit among all other items, minus the price of that item. The net profit of an item is its profit when purchased, minus its opportunity cost and its price. For example, suppose there are 3 items. Their profits are 280, 270, and 240, and their prices are 100, 100, and 100. Then the opportunity costs are 170, 180, and 180. The net profits are 10, -10, and -40.

Given the profit and the price of each item, find the net profit of each item.

입력

The first line contains the number of items NN.

The second line contains the profit of each of the NN items when purchased, separated by spaces.

The third line contains the price of each of the NN items, separated by spaces.

출력

On the first line, print the net profit of each item, separated by spaces, in the order given in the input.

제한

  • 2≤N≤3×1052 \le N \le 3\times 10^5
  • All profits and prices are integers from 11 to 10610^6, inclusive.

Examples1

  1. Example 1

    Input
    3
    280 270 240
    100 100 100
    
    Expected output
    10 -10 -40