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

문제

You are planning the fireworks to celebrate the $5$th anniversary of LTH Challenge. It will be a great show with red and green fireworks. Along a $N - 1$ meter long fuse there will be $N$ fireworks attached at each integer coordinate. The fuse can be ignited at any position (including between fireworks) and burns at the same speed in both directions, firing up the fireworks along the fuse. All fireworks have the same TLE (Time Left to Explosion), that is, fireworks at the same distance from the ignition point will explode simultaneously.

The audience especially likes when both a green and a red firework explode simultaneously, this is called an awesome combination, AC for short.

You would like to maximize the number of ACs in your show.

Some firework positions are already occupied with red or green fireworks, while other positions are up to you to decide among your extra $R$ red fireworks and $G$ green fireworks.

입력

The first line contains three integers $N$, $R$, and $G$ ($2 \leq N \leq 50,000$, $0 \leq R, G \leq 50,000$), where $N$ is the number of fireworks positions, $R$ and $G$ are the number of extra red and green fireworks respectively.

The second line contains $N$ characters each of which is one of 'R', 'G', or 'X', representing how the firework positions are originally assigned. Here, 'R' means that the firework is red, 'G' means it is green, and 'X' means that you need to place a firework at that position.

The number of positions where you need to place a firework does not exceed $R + G$

출력

A single integer. The maximum number of ACs you can create in your show.

서브태스크

번호배점제한
115

$N \leq 2000$ and $R=G=0$

220

$N \leq 2000$

330

$N \leq 50\,000$ and $R=G=0$

435

$N \leq 50\,000$

예제 입력 1

7 2 1
GGRXRXX

예제 출력 1

3

출처

Contest > Swedish Coding Cup > LTH Challenge 2022 G번

  • 문제를 만든 사람: Erik Amirell Eklöf

채점 및 기타 정보

  • 예제는 채점하지 않는다.