DP problems

Revision en1, by aeonary, 2022-11-01 15:45:15

Please help me, the statement is:

On the plane of the Cartesian coordinate system, give N points numbered from 1 to N Each point i (1 ≤ i ≤ N) has integer

coordinates (xi, yi). Candidates start from point 1, in turn move in order to points 2, 3, ..., N and they can skip exactly K

points (except 1 and N). The distance between two points (xi, yi) and (xj, yj) is | xi — xj | + | yi — yj |. Find the shortest

way to move from point 1 to point N and skip K points.

Example:

Input: N, K and N points

5 2

0 0

7 3

1 1

8 -5

2 2

Output:

4

Explain: Skip point 2 and point 4

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English aeonary 2022-11-01 15:45:15 653 Initial revision (published)