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

20033번 - Square, Not Rectangle 다국어

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

문제

A histogram is a polygon made by aligning $N$ adjacent rectangles that share a common base line. Each rectangle is called a bar. The $i$-th bar from the left has width 1 and height $H_i$.

Your goal is to find the area of the largest rectangle contained in the given histogram, such that one of the sides is parallel to the base line.

Figure 1. The histogram given in the example, with the largest rectangle shown on the right.

Actually, no, you have to find the largest square. Since the area of a square is determined by its side length, you are required to output the side length instead of the area.

Figure 2. The histogram given in the example, with the largest square shown on the right.

입력

On the first line, a single integer $N$ is given, where 1ドル \le N \leq 300,000円$.

On the next line, $N$ space-separated integers $H_1, H_2, \cdots, H_N,ドル are given. $H_i$ $(1 \le H_i \le 10^9)$ is the height of the $i$-th bar.

출력

Output the side length of the largest square in the histogram, such that one of the sides is parallel to the base line.

제한

예제 입력 1

6
3 4 4 4 4 3

예제 출력 1

4

힌트

출처

University > KAIST > KAIST ICPC Mock Competition > 2020 KAIST 10th ICPC Mock Competition K번

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

출처

대학교 대회

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

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