CF522B.Photo to Remember

普及-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

One day 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-th of them occupies the rectangle of width w__i pixels and height 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, where W is the total sum of all widths and H is the maximum height of all the photographed friends.

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

Print the minimum size of each made photo in pixels.

一天,nn 位朋友在聚会上重逢,由于许久未见,他们决定一起拍一张合影。

简单来说,拍照过程可描述如下:在照片中,每位被拍摄的朋友占据一个像素矩形区域:第 ii 位朋友占据一个宽为 wiw_i 像素、高为 hih_i 像素的矩形。在合影中,所有人排成一列,因此包含所有被拍摄朋友的最小照片像素尺寸为 W×HW \times H,其中 WW 是所有宽度之和,HH 是所有被拍摄朋友高度的最大值。

按照惯例,朋友们共拍摄了 nn 张照片——第 jj 张照片(1≤j≤n1 \leq j \leq n)中,除第 jj 位朋友担任摄影师未入镜外,其余所有人都在照片中。

请输出每张照片的最小像素尺寸。

输入格式

The first line contains integer n (2 ≤ n ≤ 200 000) — the number of friends.

Then n lines follow: the i-th line contains information about the i-th friend. The line contains a pair of integers w__i, h__i (1 ≤ w__i ≤ 10, 1 ≤ h__i ≤ 1000) — the width and height in pixels of the corresponding rectangle.

第一行包含一个整数 nn(2≤n≤200 0002 \leq n \leq 200\,000)——朋友的数量。

接下来是 nn 行:第 ii 行包含关于第 ii 位朋友的信息。该行包含一对整数 wi, hiw_i,\,h_i(1≤wi≤101 \leq w_i \leq 10,1≤hi≤10001 \leq h_i \leq 1000)——对应矩形的宽度和高度(单位:像素)。

输出格式

Print n space-separated numbers _b_1, _b_2, ..., b__n, where b__i — the total number of pixels on the minimum photo containing all friends expect for the i-th one.

输出 n 个空格分隔的整数 _b_₁, _b_₂, ..., b__n,其中 b__i 表示包含除第 i 位朋友外所有朋友的最小照片中所含像素的总数。

输入输出样例

  • 输入#1

    3
    1 10
    5 5
    10 1

    输出#1

    75 110 60
  • 输入#2

    3
    2 1
    1 2
    2 1

    输出#2

    6 4 6

输入解题思路,AI测评打分。不知道怎么写?

首页