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

24827번 - Jack The Lumberjack 다국어

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

문제

Jack the Lumberjack used to love chopping down trees. Jack is getting older and is becoming tired of this activity he used to love. He thinks of an idea, 'The Big One' and fantasizes about going out into the forest one last time to harvest as many trees as possible.

Jack calls the forest administrator for his local evergreen forest. The forest administrator tells him about how the population changes for each species of tree. For each species $k,ドル $S_k$ trees are planted in year $B_k$. For the next $Y_k$ years, the population increases by $I_k$ per year. After $Y_k$ years, it will decrease by the same amount $I_k$ per year, until possibly dying out.

Armed with this information, Jack wants to figure out the maximum amount of trees that could be harvested at once from now until the future. If he is no longer around to do it, his descendants will be!

Assume all populations change instantly and at the same time, once per year. Jack would assess each population's size after the yearly change occurred.

입력

The input contains a single test case. The first line contains an integer $N$ (1ドル \le N \le 1,000円$) representing the number of tree species in the forest.

Each of the following $N$ lines represents a single tree species population. Each of these population lines contains 4ドル$ integer numbers Y I S B (0ドル \le Y \le 1,000円,000円,ドル 0ドル \le I \le 1,000円,ドル 0ドル \le S \le 1,000円,000円,ドル 0ドル \le B \le 1,000円,000円$). where $S$ is the starting population size, $B$ the year in which the population is planted, $Y$ the number of years during which the population increases each year by $I$ before it decreases by $I$ until it (possibly) dies out.

출력

Print the maximum amount of trees that can be harvested in any single year.

제한

예제 입력 1

1
10 10 0 5

예제 출력 1

100

예제 입력 2

3
5 10 0 4
10 10 10 1
5 5 0 0

예제 출력 2

145

힌트

출처

School > Virginia Tech High School Programming Contest > 2019 Virginia Tech High School Programming Contest J번

  • 문제를 만든 사람: Vinh Pham
(追記) (追記ここまで)

출처

대학교 대회

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

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