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

Cigle

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

의견: 0

설명

Croatian Olympiad in Informatics
April \(25^{th}\) 2021
In an alternate reality Earth 616 young Stjepan lives a totally different life. Currently he is enrolled in a
bri\(ck-cr\)afting course at School of Arts and Design. As every child there, he is obsessed with patterns. For
example, his homework requires him to build a brick wall using \(N\) bricks. But he will not start building
until he is satisfied with his t\(wo-di\)mensional sketch.
On the sketch, every brick can be represented as a rectangle with unit size height and width of size \(d\)\(i\). He
chooses the order of bricks beforehand and starts sketching from the bott\(om-mo\)st row.
In the first row he will place some number of bricks going from left to right. In the second row he will be
placing bricks from right to left and the first brick in the second row will align with the last brick in the
first row (their right edges will align). Next, in the third row he will be placing the bricks again from left
to right. The first brick in the third row will align with the last from the second row but this time the left
edges. He continues this process until there are no bricks left. He may choose to build wall with arbitrary
number of rows.
Stjepan uses super cement so a brick may be placed in the wall so that there is no other brick directly
underneath. Beauty of the wall is a number of places where 4 bricks touch
For a given order of bricks and their respective sizes help find the largest possible beauty of the wall.

제약

Subtask 1 (9 points): \(1 \le N \le 20\)

Subtask 2 (11 points): \(1 \le N \le 80\)

Subtask 3 (13 points): \(1 \le N \le 500\), \(1 \le M \le 2\)

Subtask 4 (15 points): \(1 \le N \le 500\)

Subtask 5 (52 points): \(1 \le N \le 5\,000 2\) od 7 Croatian Olympiad in Informatics April \(25^{th}\) 2021

입력 형식

First line contains an integer \(N\) from the task description.
Second line contains \(N\) integers \(d_{i}\) from the task description.

출력 형식

Print the largest possible beauty of any wall that can be built.

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

1

9점

\(1 \le N \le 20\)

2

11점

\(1 \le N \le 80\)

3

13점

\(1 \le N \le 500\), \(1 \le M \le 2\)

4

15점

\(1 \le N \le 500\)

5

52점

\(1 \le N \le 5\,000 2\) od 7 Croatian Olympiad in Informatics April \(25^{th}\) 2021

예제 1
입력
6
2 2 2 1 1 2
출력
2
예제 2
입력
13
9 5 2 8 8 2 5 9 9 7 8 5 10
출력
5
예제 3
입력
12
5 5 2 3 2 1 1 5 5 2 5 1
출력
4
Wall with beauty 4 for the third example.
3 od 7
문제 정보

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

출처 COCI 2020/2021 Olympiad

평가 및 의견

Cigle

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

Log in to rate problems.

개별 의견

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

풀이 제출

Cigle

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