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

Histogram

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

의견: 0

설명

Mr. Malnar (over the phone): Listen, I had to put up some posters around Zagreb in the middle
of the night. I stumbled upon a fence that was made out of some planks of varying heights, and I was
thinking about how to calculate the largest area of a poster that I can fit on the fence. Wouldn’t that
make a nice COCI problem?
Associate: You were doing what?! Anyway, the problem is no good. It’s a standard trick with a monotone
queue, we even teach that to elementary school students on our camps.
Mr. Malnar: What if you twist it a bit, ask for the answer for every prefix or something like that, that
should be hard enough.
Associate: That exact problem was featured last year in our CERC qualification contest. A tough one,
it boils down to the Harbingers trick, but now everyone has seen it.
Mr. Malnar: Are you sure there is nothing we can do?
Associate: I think we have exhausted all problems with histograms. COCI \(2010/2011\) (Tabovi), COCI
\(2015/2016\) (Poplava), COCI \(2017/2018\) (Krov), IOI selection test 2018 (Histogram)... You get the point.
Mr. Malnar: What if the histogram is thr\(ee-di\)mensional?
Associate: Umm...
You are given a 3D histogram, that consists of \(n\) blocks that are placed next to each other. The \(i-th\)
block is 1 meter wide, \(a@@RISE_MATH_BLOCK_0@@i\) meters long. In other words, from the front it looks like a
histogram with bars of heights \(a_{1}\), a_{2}, . . . a_{n}, and from the top it looks like a histogram with bars of heights
\(b\)1, b2, . . . b\(n\).
Determine the block with maximum volume that can be placed inside the given 3D histogram. The
sides of that block need to be parallel with the sides of the blocks that make up the 3D histogram.

제약

Subtask 1 (20 points): \(1 \le n \le 2000\)

Subtask 2 (90 points): \(1 \le n \le 200\,000\)

입력 형식

The first line contains the integer \(n\) from the task description.
The \(i-th\) of the following \(n\) lines contains integers \(a_{i}\) and \(b_{i}\) (\(1 \le a_{i}\), \(b_{i} \le 10^{6}\)) from the task description.

출력 형식

Print the volume in cubic meters.

서브태스크
서브태스크점수설명

1

20점

\(1 \le n \le 2000\)

2

90점

\(1 \le n \le 200\,000\)

예제 1
입력
5
5 3
4 4
2 1
3 2
1 5
출력
24
예제 2
입력
6
3 1
2 1
2 2
2 3
1 1
2 2
출력
8
예제 3
입력
5
15 19
5 6
1 13
3 7
1 2
출력
285
문제 정보

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

출처 COCI 2020/2021 Contest 1

평가 및 의견

Histogram

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

Log in to rate problems.

개별 의견

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

풀이 제출

Histogram

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