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

34290번 - Cheese Touch 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB124702740.909%

문제

Colorado School of Mines has a big problem! Somebody left a piece of cheese in front of the Student Center, and now several students are infected with the "cheese touch". These infected students can spread it to anyone adjacent to them, but not through walls. Although a cure is being developed, it may not come fast enough to stop the spread.

The "cheese touch" spreads every $p$ minutes (at times $p, 2p, 3p, \ldots$), infecting people directly adjacent to infected individuals. The cure will be ready after $t$ minutes. The cure acts immediately, so the infection is not spread at time $t$ or any time after.

입력

The first line of input contains two integers $p$ (1ドル \leq p \leq 3000$) and $t$ (1ドル \leq t \leq 3000$) representing the minutes it takes for the "cheese touch" to spread and the minutes it takes to find a cure, respectively.

The second line contains a single string $s$ (1ドル \leq |s| \leq 3000$) consisting of the characters 'H', 'I', and 'W' representing the initial configuration of Healthy people, Infected people, and Walls, respectively. It is guaranteed that there will be at least 1ドル$ healthy person.

출력

Print out "CURED" if the cure was released before all the healthy people became infected or "ALL INFECTED" if the cure came too late (without quotes).

제한

예제 입력 1

1 3
HIH

예제 출력 1

ALL INFECTED

예제 입력 2

1 10
HWIIHI

예제 출력 2

CURED

예제 입력 3

2 4
HHIWHI

예제 출력 3

CURED

힌트

출처

School > CS@Mines > CS@Mines HSPC 2025 J번

  • 문제를 만든 사람: Adeline Greene
(追記) (追記ここまで)

출처

대학교 대회

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

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