Блог пользователя aeonary

Автор aeonary, история, 19 месяцев назад, По-английски

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

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

»
19 месяцев назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

This is the same as the USACO Problem Marathon.

Read the editorial here