RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00243

Popust

Unrated 레이팅 미적용
난이도
2s
시간 제한
32MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

\(2^{nd}\) round, November \(10^{th}\), 2012

Mirko is hungry as a bear, scratch that, programmer and has stumbled upon a local restaurant. The
restaurant offers N meals and has an interesting pricing policy: each meal i has two assigned prices, A_{i}
and B_{i}. Mirko pays A only for the first ordered meal, while B prices apply for all other meals.
Mikro can't decide how many meals to order. In order to make his decision easier, he has asked you to
compute, for each k between 1 i N (inclusive), the minimum total price for k ordered meals. Mirko
doesn't care which particular meals he orders or in which order he orders them, however he won't
order the same meal twice. Order, order, order.

제약
입력 형식

The first line of input contains the positive integer N (\(2 \le N \le 500\,000\)), the number of different
meals offered by the restaurant.
Each of the following N lines contains two positive integers, A_{i}and B_{i} (\(1 \le A_{i}\), \(B_{i} \le 1\,000\,000\,000\)), the
prices for meal i as described above.

출력 형식

Output must consist of N lines, where line k contains the minimum price for ordering exactly k
different meals.

예제 1
입력
3
10 5
9 3
10 5
출력
9
13
18
예제 2
입력
2
100 1
1 100
출력
1
2
예제 3
입력
5
1000000000 1000000000
1000000000 1000000000
1000000000 1000000000
1000000000 1000000000
1000000000 1000000000
출력
1000000000
2000000000
3000000000
4000000000
5000000000
설명

Clarification of the first example:
k = 1: Mirko pays A2 = 9 for the starting meal 2.
k = 2: Mirko pays A1 = 10 for the starting meal 1, then B2 = 3 for meal 2.
k = 3: Mirko pays A1 = 10 for the starting meal 1, then B2 = 3 for meal 2, and finally B3 = 5 for meal 3.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2012/2013 Contest 2

평가 및 의견

Popust

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Popust

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8