Stone Tag Game
Time limit1sMemory limit512 MB
Given black stone positions on a grid, decide whether Yuto's white stone leaves the board first or Platina's black stones catch it under alternating moves.
- Level
Medium7 of 10
- Topics
- Game theory, Math, Greedy
- Solved
- No attempts yet
Problem
Yuto and Platina want to play a stone tag game. The game takes place on a two-dimensional coordinate plane, but only the part where both the x and y coordinates are at most is used as the board.
There is one white stone and black stones on the board. At the start, the white stone is at , and the -th black stone is at .
On his turn, Yuto moves the white stone one cell to or from its current position .
On her turn, Platina picks any black stone at and moves it one cell to or .
Yuto goes first, and the two players alternate turns. If the white stone leaves the board, Yuto wins. If the white stone and a black stone occupy the same cell before that happens, Platina wins.
Both players can play perfectly, but the board is so large that they want to know the winner in advance. Find out who wins the game.
Input
The first line contains the number of black stones . Each of the next lines contains the position and of the -th black stone.
Output
Print the name of the player who wins the game. The first letter of the name is capitalized.