아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Fireworks

시간 제한2초메모리 제한1024 MB

요약
도화선의 X 위치에 주어진 빨강, 초록 폭죽을 배치한 뒤 점화 지점을 정해 같은 거리에서 동시에 터지는 빨강-초록 쌍의 수를 최대화한다.
난이도

보통10점 중 7점

유형
그리디, 수학, 구현
정답자
아직 제출이 없습니다

문제

You are planning the fireworks to celebrate the 55th anniversary of LTH Challenge. It will be a great show with red and green fireworks. Along a N−1N - 1 meter long fuse there will be NN 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 RR red fireworks and GG green fireworks.

입력

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

The second line contains NN 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+GR + G

출력

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

예제1

  1. 예제 1

    입력
    7 2 1
    GGRXRXX
    
    예상 출력
    3