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

Kuglice

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

의견: 0

설명

Christmas time is approaching, the most beautiful time of the year. Our protag-
onists, Marin and Josip, have returned from Christmas shopping and have started
decorating their Christmas tree.
They bought \(n\) Christmas ornaments arranged next to each other in an elongated
box, and the \(i-th\) ornament has the color \(a\)\(i\). The box is open on both sides, so
the ornaments can be taken out from both the left and the right side of the box.
The box is transparent, so Marin and Josip can see the color of each ornament.
The illustration shows the initial state \(of\) the box \(in\) the second example. \(On\) his first move, Marin can
draw either \(an\) ornament \(of\) color 1 from the left end \(of\) the box \(or\) \(an\) ornament \(of\) color 3 from the right
end \(of\) the box.
Josip came up with a game that would make decorating the tree even more fun, although it’s already a
lot of fun by itself. The game works as follows: Marin and Josip take turns, and Marin starts the game.
The player in turn draws an ornament from the box (either from the left or the right end of the box) and
places it on the tree. If they draw an ornament whose color has not been drawn yet, the player scores a
point. The game ends when the last ornament is drawn from the box.
The winner of the game is the player who has scored more points, so both Marin and Josip want to
maximize their number of points. Since both of them are excellent players, they will play optimally. Your
task is to print the result at the end of the game.

제약

Subtask 1 (17 points): \(a_{i} \le 2\) for all \(i = 1\), . . . , n

Subtask 2 (10 points): \(n \le 20\)

Subtask 3 (26 points): \(a_{i} \le 20\) for all \(i = 1\), . . . , n

Subtask 4 (15 points): \(n \le 300\)

Subtask 5 (42 points): No additional constraints.

입력 형식

The first line contains an integer \(n\) (\(1 \le n \le 3\,000\)), the number of ornaments in the box.
The second line contains \(n\) integers \(a@@RISE_MATH_BLOCK_0@@i \le n\)), the colors of the ornaments in the box.

출력 형식

In the first and only line, print the result of the game, i.e., two numbers connected by the character ’:’
(without quotes), Marin’s and Josip’s scores.

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

1

17점

\(a_{i} \le 2\) for all \(i = 1\), . . . , n

2

10점

\(n \le 20\)

3

26점

\(a_{i} \le 20\) for all \(i = 1\), . . . , n

4

15점

\(n \le 300\)

5

42점

No additional constraints.

예제 1
입력
5
1 1 2 1 1
출력
1:1
예제 2
입력
6
1 2 3 1 2 3
출력
2:1
설명

Clarification of the first example:
Marin is first, and he draws an ornament of color 1 from the left end
of the box. Marin scores a point.
Josip draws an ornament of color 1 from the right end of the box, but he
does not score a point because a ball of color 1 has already been drawn.
Marin draws an ornament of color 1 from the left end of the box. He
does not score a point either because a ball of color 1 has already been
drawn.
Josip draws an ornament of color 2 from the left end of the box. This
is the first ball of color 2 drawn, so Josip scores a point.
Marin draws the last ornament (color 1) from the left end of the box,
but it does not earn him a point, and the game ends.
Marin has a total of 1 point (he drew the ornament of color 1 first), and
Josip also has a total of 1 point (he drew the ornament of color 2 first).
The final result is 1 : 1.

문제 정보

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

출처 COCI 2023/2024 Contest 2

평가 및 의견

Kuglice

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

Log in to rate problems.

개별 의견

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

풀이 제출

Kuglice

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