Logo
(追記) (追記ここまで)

17169번 - Eat Economically 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 (추가 시간 없음) 1024 MB5291459924.874%

문제

Ho has arrived in a secret place for her secret business trip. She knows her trip will take at most $N$ days or shorter but doesn't know the exact number of days she'll be there. So, the perfectionist Ho wants to make the daily meal lists for every possible trip length, 1ドル$ day to $N$ days.

There is the only food court that offers exactly 2ドルN$ kinds of menus (by accident) in this secret place. The food court opens only lunch time and dinner time, and oddly, the prices of lunch and dinner for the same menu can be different.

She will eat exactly one menu per lunch and dinner respectively and never eat the same menu for the entire of the trip. She never minds about which kind of menu will be her meal, the only important thing is the entire price of meals must be minimized.

Under these conditions, she can make her meal lists but realizes that writing every $N(N+1)$ menu is hard and tiresome. So, instead of making the meal lists, she calculates the minimized entire price for $i$ lunch menus and $i$ dinner menus where $i=1$ to $N$.

You, the big fan of Ho, has a supreme task. Print the $N$ prices she calculated.

입력

The first line contains an integer $N$.

In the next 2ドルN$ lines, each line contains two integer $l, d$ denoting the prices of the menus when lunch and dinner respectively.

출력

Print $N$ lines. The $i$-th line (1ドル \le i \le N$) should contain an integer denoting the minimized entire price for $i$ lunch menus and $i$ dinner menus.

제한

  • 1ドル \leq N \leq 250,000円$
  • 1ドル \leq l, d \leq 10^9$

서브태스크 1 (16점)

This subtask has an additional constraint.

  • $N \le 100$

서브태스크 2 (33점)

This subtask has an additional constraint.

  • $N \le 10,000円$

서브태스크 3 (51점)

This subtask has no additional constraints.

예제 입력 1

1
4 9
5 3

예제 출력 1

7

예제 입력 2

2
1 6
2 4
5 3
3 1

예제 출력 2

2
7

예제 입력 3

4
7 5
5 7
7 4
4 2
2 5
6 4
3 2
1 9

예제 출력 3

3
7
16
26

힌트

출처

University > KAIST > KAIST RUN Spring Contest > 2019 KAIST RUN Spring Contest F번

Contest > Open Cup > 2018/2019 Season > Stage 19: Grand Prix of Daejeon E번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /