Line Game
Time limit1sMemory limit128 MB
Two players alternately draw unused axis-parallel lines through marked points on the previous line, and the program names the side with a winning strategy.
- Level
Medium7 of 10
- Topics
- Game theory, Graph
- Solved
- No attempts yet
Problem
Mirko and Slavko decided to invent a new game.
Before the game starts, the two of them mark points on the coordinate plane. They then take turns drawing one line each, and Mirko goes first.
Mirko draws a line parallel to one of the coordinate axes that passes through one of the points. From then on, each player draws a line parallel to a coordinate axis that passes through one of the points lying on the line the opponent drew on the previous turn. The same line cannot be drawn twice. The player who cannot draw a line loses.
Write a program that determines which player has a winning strategy.
Input
The first line contains . ()
Each of the next lines contains the coordinates and of one marked point. ()
Output
Print Mirko if Mirko wins, or Slavko if Slavko wins.