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

6154번 - Artificial Lake 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB38191851.429%

문제

The oppressively hot summer days have raised the cows' clamoring to its highest level. Farmer John has finally decided to build an artificial lake. For his engineering studies, he is modeling the lake as a two-dimensional landscape consisting of a contiguous sequence of N soon-to-be-submerged levels (1 <= N <= 100,000) conveniently numbered 1..N from left to right.

Each level i is described by two integers, its width W_i (1 <= W_i <= 1,000) and height (like a relative elevation) H_i (1 <= H_i <= 1,000,000). The heights of FJ's levels are unique. An infinitely tall barrier encloses the lake's model on the left and right. One example lake profile is shown below.

 * * :
 * * :
 * * 8
 * *** * 7
 * *** * 6
 * *** * 5
 * ********** 4 <- height
 * ********** 3
 *************** 2
 *************** 1
Level | 1 |2| 3 |

In FJ's model, he starts filling his lake at sunrise by flowing water into the bottom of the lowest elevation at a rate of 1 square unit of water per minute. The water falls directly downward until it hits something, and then it flows and spreads as room-temperature water always does. As in all good models, assume that falling and flowing happen instantly. Determine the time at which each elevation's becomes submerged by a single unit of water.

 WATER WATER OVERFLOWS 
 | | 
 * | * * | * * *
 * V * * V * * *
 * * * .... * *~~~~~~~~~~~~*
 * ** * *~~~~** : * *~~~~**~~~~~~*
 * ** * *~~~~** : * *~~~~**~~~~~~*
 * ** * *~~~~**~~~~~~* *~~~~**~~~~~~*
 * ********* *~~~~********* *~~~~*********
 *~~~~********* *~~~~********* *~~~~*********
 ************** ************** **************
 ************** ************** **************
 After 4 mins After 26 mins After 50 mins
 Lvl 1 submerged Lvl 3 submerged Lvl 2 submerged

Warning: The answer will not always fit in 32 bits.

입력

  • Line 1: A single integer: N
  • Lines 2..N+1: Line i+1 describes level i with two space-separated integers: W_i and H_i

출력

  • Lines 1..N: Line i contains a single integer that is the number of minutes that since sunrise when level #i is covered by water of height 1.

제한

예제 입력 1

3
4 2
2 7
6 4

예제 출력 1

4
50
26

힌트

출처

Olympiad > USA Computing Olympiad > 2007-2008 Season > USACO January 2008 Contest > Gold 2번

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

출처

대학교 대회

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

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