FoxAndFencingEasy
SRM 598 · 2013-06-25 · by cgy4ever
Problem Statement
Each of the players has a single token called the fencer. At the beginning of the game, Ciel's fencer is in cell 0 and Liss's fencer is in cell d. Each of the fencers has a limit: its maximum move length. For Ciel's fencer the maximum move length is mov1 and for Liss's fencer it is mov2.
The players take alternating turns. Ciel goes first. In each turn the current player moves her fencer. The distance between the original cell and the destination cell must be at most equal to the fencer's maximum move length. (It is also allowed to leave the fencer in the same cell.) If the current player moves her fencer into the cell with the other fencer, the current player's fencer scores a hit and wins the game.
You are given the
Constraints
- mov1 will be between 1 and 100,000,000, inclusive.
- mov2 will be between 1 and 100,000,000, inclusive.
- d will be between 1 and 100,000,000, inclusive.
1 58 1 Returns: "Ciel"
Ciel can win in her first turn by moving her fencer one cell to the right.
100 100 100000000 Returns: "Draw"
Liss can avoid getting hit forever by repeating Ciel's moves. For example, whenever Ciel moves her fencer 47 cells to the right, Liss also moves her fencer 47 cells to the right. Ciel has a similar strategy: in her first turn she can move her fencer arbitrarily and in each of the following turns she will repeat Liss's previous move. Therefore the game ends in a draw.
100 150 100000000 Returns: "Draw"
100 250 100000000 Returns: "Liss"
1 1 1 Returns: "Ciel"
Submissions are judged against all 241 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class FoxAndFencingEasy with a public method string WhoCanWin(int mov1, int mov2, int d) · 241 test cases · 2 s / 256 MB per case