1683: 上升点列

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:4 Solved:4

Description

在一个二维平面内,给定 lns="http://www.w3.org/1998/Math/MathML"> 个整数点 lns="http://www.w3.org/1998/Math/MathML">(),此外你还可以自由添加 lns="http://www.w3.org/1998/Math/MathML"> 个整数点。

你在自由添加 lns="http://www.w3.org/1998/Math/MathML"> 个点后,还需要从 lns="http://www.w3.org/1998/Math/MathML">+ 个点中选出若干个整数点并组成一个序列,使得序列中任意相邻两点间的欧几里得距离恰好为 lns="http://www.w3.org/1998/Math/MathML">1 而且横坐标、纵坐标值均单调不减,即 lns="http://www.w3.org/1998/Math/MathML">+1=1+1= 或 lns="http://www.w3.org/1998/Math/MathML">+1  ;  ,�=1+1=。请给出满足条件的序列的最大长度。

Input

第一行两个正整数 lns="http://www.w3.org/1998/Math/MathML">, 分别表示给定的整点个数、可自由添加的整点个数。

接下来 lns="http://www.w3.org/1998/Math/MathML"> 行,第 lns="http://www.w3.org/1998/Math/MathML"> 行两个正整数 lns="http://www.w3.org/1998/Math/MathML">, 表示给定的第 lns="http://www.w3.org/1998/Math/MathML"> 个点的横纵坐标。

Output

输出一个整数表示满足要求的序列的最大长度。

Sample Input Copy

8 2
3 1
3 2
3 3
3 6
1 2
2 2
5 5
5 3

Sample Output Copy

8

HINT

【数据范围】

保证对于所有数据满足:1≤n≤500,0≤k≤100。对于所有给定的整点,其横纵坐标 1≤xi,yi≤10^9,且保证所有给定的点互不重合。对于自由添加的整点,其横纵坐标不受限制。

测试点编号

n

k

xi,yi

12

1010

00

1010

34

10

100

100

57

500

0

100

810

500

0

10^9

1115

500

100

100

1620

500

100

10^9