AIOC Banner

Problem: Snap Dragons II

Want to try solving this problem? You can submit your code online if you log in or register.


Snap Dragons II

Input File: snapin.txt
Output File: snapout.txt
Time Limit: 1 second

Have you ever heard of Melodramia, my friend? It is a land of magic forests and mysterious swamps, of sprinting heroines and dashing heroes. And it is home to two dragons, Rose and Scarlet, who, despite their competitive streak, are the best of friends.

Rose and Scarlet love playing snap tag, a game for two players on an grid. The game goes as follows:

Rose and Scarlet are both snap tag experts and always find a winning strategy if one exists. If it is not possible for either player to gain the upper hand, then the game goes on forever.

In this task, you are given the size of the grid and the starting locations of both dragons. You must write a program to determine how the game ends: Does Rose win? Does Scarlet win? Does the game go on forever?

Input

The input file will contain six space separated integers on a single line, in the format: R C rROSE cROSE rSCARLET cSCARLET where:

Output

Output should consist of a single upper-case word with no punctuation.

Sample Input 1

2 3 1 1 2 3

Sample Output 1

ROSE

Explanation

In the first example, Rose can guarantee herself a win if she is clever and cautious.

On her first move, Rose steps to the right. Then, no matter whether Scarlet goes up or left on her turn, Rose can tag her the next turn.


Sample Input 2

5 1 2 1 4 1

Sample Output 2

SCARLET

Explanation

In the second example, Scarlet can guarantee herself a win if she is clever and cautious.

If Rose moves down, then Scarlet will tag her on her very next turn. Otherwise, if Rose moves up, then Scarlet moves up and Rose will be forced to move down next to Scarlet, who will tag her the next turn.

Sample Input 3

15 15 3 5 12 13

Sample Output 3

ROSE

Explanation

In the third example, Rose can guarantee herself a win if she is clever and cautious.

Subtasks & Constraints

 


Privacy statement
© Australian Mathematics Trust 2001-2019

Contact: training@orac.amt.edu.au
Page generated: 24 May 2019,  4:21am AEST