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

34501번 - Busy Beaver's Colorful Walk 서브태스크스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB1110685.714%

문제

Busy Beaver is taking a walk on a path of colorful tiles.

The path consists of a line of $N$ tiles, each colored either red (r), green (g), blue (b), or yellow (y).

Busy Beaver's walk will follow these rules:

  • The walk visits $N$ tiles, starting from any initial tile.
  • Each move must be to a tile at most two positions away from the current tile (possibly revisiting a previously visited tile, going backwards, or staying at the same tile).

Busy Beaver will record the sequence of tile colors he visits on the walk in order. Busy Beaver is confident that he can recreate any sequence of $N$ colors on his walk.

Prove him wrong by providing any sequence of $N$ colors he can't recreate.

It can be shown that an answer always exists.

입력

Each test contains multiple test cases. The first line contains the number of test cases $T$ (1ドル \leq T \leq 10^4$). The description of the test cases follows.

The first line of each test case contains an integer $N$ (3ドル \leq N \leq 3000$) --- the number of tiles.

The second line of each test case contains a length $N$ string of characters in ('r', 'g', 'b', 'y'), the $i$'th character denoting the color of the $i$'th tile.

It is guaranteed that the sum of $N$ across all test cases is no more than 3ドル \cdot 10^5$.

출력

For each test case, output the answer-sequence as a string of characters in ('r', 'g', 'b', 'y').

제한

서브태스크

번호배점제한
110

$N \leq 10, T \leq 10^3$.

210

$N \leq 100, T \leq 10^3$.

380

No additional constraints.

예제 입력 1

3
3
rgb
3
gby
7
rgbybgr

예제 출력 1

yyy
rrr
yryryry

노트

In the first test case, yellow never appears, so a sequence of 3ドル$ yellows is not possible.

In the second test case, red never appears, so a sequence of 3ドル$ reds is not possible.

In the third test case, every red tile is at least 3ドル$ positions away from the yellow tile. So, any walk transitioning from a yellow to a red tile is impossible.

출처

University > MIT > M(IT)^2 > M(IT)^2 Spring 2025 Invitational > Qualification Round 2 3번

채점 및 기타 정보

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

출처

대학교 대회

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

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