Logo
(追記) (追記ここまで)

21287번 - Färgrobot 서브태스크스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB105726870.833%

문제

A robot can move along a row of colored squares. Every square can be either red, green or blue. A command to the robot is a color. The robot responds by moving to the right until it stands on the color specified by the command. Write a program that, for a given sequence of squares and a number $N,ドル writes out the sequence of $N$ commands that makes the robot go as far to the right as possible.

Figure 1: An illustration of the third sample case.

입력

The first line containes an integer $N,ドル the number of commands to give to the robot. The second line contains a string of letters, R , G, or B, which specifies the color of each square in the row, from left to right. The string contains less than 200 characters, and is always sufficiently long that no sequence of $N$ commands may cause the robot to reach outside the row of squares.

출력

The program should output a string of $N$ characters, each being R, G, or B, which constitutes the sequence of commands you should give to the robot to make it move as far as possible along the row of squares. If there are several sequences that accomplish this, you may output anyone of them.

제한

서브태스크

번호배점제한
120

$N=4$ and the sequence is 'RGBGGBGRBRBRGRGRB' (i.e. the case shown on this year's PO poster)

230

1ドル \le N \le 4$

320

5ドル \le N \le 10$

430

20ドル \le N \le 25$

예제 입력 1

1
RRBBBGG

예제 출력 1

G

예제 입력 2

2
GBBRGRGBRG

예제 출력 2

RB

예제 입력 3

3
RGBGRRBGBBRG

예제 출력 3

BBR

예제 입력 4

4
RBRBRBBRBRBRGRGGRGGGRBBRBRRBBRBRBRGBGBGBBGBGBGBBBGBGR

예제 출력 4

GBGR

힌트

출처

Olympiad > Swedish Olympiad in Informatics > 2016 > Online Qualification C번

  • 문제를 만든 사람: Pär Söderhjelm

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /