Witness
Time limit1sMemory limit512 MB
Given a one-dimensional row of Baba Is You blocks and obstacles, decide whether BABA can reach the FLAG and print BABA IS WIN or BABA IS NOT WIN.
- Level
Easy2 of 10
- Topics
- Implementation, Simulation
- Solved
- No attempts yet
Problem
WITNESS IS BABA!
Writing a real Baba Is You solver would be unfair to the 구데기컵 participants, so assume the following rules are absolute truth:
Also assume the map always has the form shown below.

So the input is a row of text blocks and obstacles in order, laid out in one dimension. You may assume there is enough space between obstacles, and each obstacle is one layer thick.
Your job is to decide whether the given level can be won.
Input
The first line contains at most 100 blocks. Blocks are separated by spaces.
The second line gives the type of each obstacle.
Output
If the level can be won, print BABA IS WIN. Otherwise, print BABA IS NOT WIN.