#P16015. [ICPC 2021 NAC] Cleaning Robot
[ICPC 2021 NAC] Cleaning Robot
题目描述
A company wishes to purchase a square-shaped cleaning robot to clean a rectangularly shaped room. Some parts of the room are obstructed.
There are different robots of different sizes. Each robot can move horizontally and vertically in the room if no part of the robot intersects an obstruction. They are incapable of changing orientation, so movements are always axis-aligned. Larger robots will get the job done faster, but are more likely to be hindered by obstructions. The robot must always remain fully in the room with no portion extending past the edges of the rectangle.
What is the largest robot the company can buy that will be able to clean all the squares of the room not occupied by obstructions?
输入格式
The first line of input contains three integers , ( and ) and (, ), where and are the dimensions of the room in inches, and is the number of obstructions.
Each of the next lines contains two integers and (). This specifies that the one-inch square at is obstructed. All obstructed squares are distinct.
输出格式
Output a single integer, which is the maximum length of one side of the largest square-shaped robot that could clean the entire room, or if no such robot could clean the entire room.
10 7 1
8 3
2