#P10760. Maximizing Colors in a Teleporting Grid
Maximizing Colors in a Teleporting Grid
Maximizing Colors in a Teleporting Grid
You are playing a prank on your friend. Your friend starts at \( (0,0) \) on an infinite grid. Every cell of the grid is colored. There are \( N \) teleporters located on some cells. When your friend enters any cell that contains a teleporter, he is instantly teleported to one of the \( N \) teleporter cells uniformly at random (possibly even back to the same teleporter). However, your friend is unaware of the teleporters; his only perception of the world is the sequence of colors of the cells he visits. In other words, he believes he is following a certain path based solely on those colors.
Your task is to design a coloring scheme for the entire grid so that no matter which path your friend takes and regardless of how the random teleportations occur, the color he sees at each step always matches the color he expects (i.e. the color of the cell he would have been in if there were no teleportation).
You are free to choose the colors arbitrarily for each cell, but you want to maximize the number of distinct colors used in your scheme. It is trivial to note that coloring every cell with a single color is always a valid (but minimal) solution. However, a careful analysis shows that all teleporter cells must share the same color – because if your friend steps on what he thinks is a particular teleporter, he might be teleported to any other teleporter and must still see the same color. On the other hand, the non‐teleporter cells have no such restriction. Since there are infinitely many non teleporter cells, you can assign each a unique color.
Thus, the maximum number of distinct colors that can be used is infinite.
Note: The input will provide the value of \( N \) and the coordinates of the \( N \) teleporters.
inputFormat
The first line contains an integer \( N \) (\( 1 \leq N \leq 10^5 \)), the number of teleporters. Each of the next \( N \) lines contains two space-separated integers \( x \) and \( y \) (\( -10^9 \leq x,y \leq 10^9 \)) representing the coordinates of a teleporter. Note that teleporters may be located at any cells of the infinite grid, including \( (0,0) \).
outputFormat
Output a single line containing the word Infinite
, indicating that the maximum number of distinct colors that can be used in a valid coloring scheme is unbounded.
sample
1
0 0
Infinite