#P4818. Photo to Remember

Photo to Remember

Photo to Remember

题面翻译

某一天,n个朋友在一起聚会,他们已经很久没见了,于是他们决定拍照留念。

简单的说,拍照的时候,每个人有一个高度和宽度,第i个的高度和宽度分别是hi和wi。这些人排成一条直线,照片的最小的面积必须包含所有的的人,所以照片的面积是W*H,W是所有人的宽度之和,H是所有人中高度最高的那个人的高度。现在想要知道当第i个人不在照片中的时候,照片的最小面积是多少。

输入

第一行是一个正整数N,表示人的数量。

接下来N行,每行两个整数wi和hi,分别表示每个人的宽度和高度。

数据范围:2<=N<=200000,1<=wi<=10,1<=hi<=1000。

输出

包含b1,b2,b3。。Bn,bi表示第i个人不在照片中的时候,照片的最小面积。

题目描述

One day n n friends met at a party, they hadn't seen each other for a long time and so they decided to make a group photo together.

Simply speaking, the process of taking photos can be described as follows. On the photo, each photographed friend occupies a rectangle of pixels: the i i -th of them occupies the rectangle of width wi w_{i} pixels and height hi h_{i} pixels. On the group photo everybody stands in a line, thus the minimum pixel size of the photo including all the photographed friends, is W×H W×H , where W W is the total sum of all widths and H H is the maximum height of all the photographed friends.

As is usually the case, the friends made n n photos — the j j -th ( 1<=j<=n 1<=j<=n ) photo had everybody except for the j j -th friend as he was the photographer.

Print the minimum size of each made photo in pixels.

输入格式

The first line contains integer n n ( 2<=n<=200000 2<=n<=200000 ) — the number of friends.

Then n n lines follow: the i i -th line contains information about the i i -th friend. The line contains a pair of integers wi,hi w_{i},h_{i} ( 1<=wi<=10,1<=hi<=1000 1<=w_{i}<=10,1<=h_{i}<=1000 ) — the width and height in pixels of the corresponding rectangle.

输出格式

Print n n space-separated numbers b1,b2,...,bn b_{1},b_{2},...,b_{n} , where bi b_{i} — the total number of pixels on the minimum photo containing all friends expect for the i i -th one.

样例 #1

样例输入 #1

3
1 10
5 5
10 1

样例输出 #1

75 110 60

样例 #2

样例输入 #2

3
2 1
1 2
2 1

样例输出 #2

6 4 6