#P14010. 「florr IO Round 1」遍历游戏
「florr IO Round 1」遍历游戏
Description
There are key points on the plane, each with integer coordinates in .
It is guaranteed that these key points are four-connected, and that the plane becomes eight-connected after removing these key points.
Let denote the shortest path length from the -th key point to the -th key point, where a valid path is defined as follows:
A path is a sequence of point pairs , where the Manhattan distance between each pair of adjacent points is , that is, , and every point in the sequence is a key point.
The length of this path is defined as , and the shortest path between two points is the shortest among all valid paths.
Given and , find how many pairs satisfy .
Input Format
The first line contains two integers, and , representing the number of key points and the parameter .
The next lines each contain two integers, where the -th line gives the coordinates of the -th key point.
It is guaranteed that the given points are distinct and satisfy the properties described above.
Output Format
Output a single integer representing the answer.
5 2
1 3
1 4
2 4
2 5
2 6
3
Hint
Data Range
This problem uses bundled tests.
| Subtask | Special Property | Score | ||
|---|---|---|---|---|
| None | ||||
| All key points form a rectangle | ||||
| No square is fully occupied by key points | ||||
| None | ||||
- For of the data, it is guaranteed that .
Translated by ChatGPT 4.1
京公网安备 11011102002149号