aeonary's blog

By aeonary, history, 18 months ago, In English

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

  • Vote: I like it
  • +1
  • Vote: I do not like it

| Write comment?
»
18 months ago, # |
  Vote: I like it +1 Vote: I do not like it

This is the same as the USACO Problem Marathon.

Read the editorial here