#P8816. [CSP-J 2022] 上升点列
[CSP-J 2022] 上升点列
Problem Description
On a two-dimensional plane, you are given integer points . In addition, you may freely add integer points.
After adding points, you need to select some integer points from the points to form a sequence such that the Euclidean distance between any two adjacent points in the sequence is exactly , and both the -coordinate and the -coordinate are non-decreasing. That is, either , or . Please output the maximum possible length of such a sequence.
Input Format
The first line contains two positive integers , representing the number of given integer points and the number of integer points you may freely add.
The next lines each contain two positive integers , representing the coordinates of the -th given point.
Output Format
Output one integer representing the maximum length of a sequence that satisfies the requirements.
8 2
3 1
3 2
3 3
3 6
1 2
2 2
5 5
5 3
8
4 100
10 10
15 25
20 20
30 30
103
Hint
【Sample #3】
See point/point3.in and point/point3.ans in the attachments.
In the third sample, .
【Sample #4】
See point/point4.in and point/point4.ans in the attachments.
【Constraints】
It is guaranteed that for all testdata: , . For all given integer points, , and all given points are distinct. For the integer points you add freely, the coordinates have no restrictions.
| Test Point ID | |||
|---|---|---|---|
Translated by ChatGPT 5