This page is still under construction.

Parts of this page are still being built. What you see may change.

KOSTA

Time limit5sMemory limit256 MB

Summary
Place one or two machines on given restaurant sites to minimize the farthest Manhattan delivery distance, and report that distance with the chosen sites.
Level

Medium7 of 10

Topics
Binary search, Geometry
Solved
No attempts yet

Problem

Grill master Kosta opened NN restaurants in Manhattan at integer coordinates. The distance between restaurants AA and BB is ∣XA−XB∣+∣YA−YB∣|X_A - X_B| + |Y_A - Y_B|. Kosta will install at most KK burger machines (KK is 11 or 22) in existing restaurants and deliver burgers each morning from the nearest machine. For restaurant CC, let DCD_C be the distance to the closest machine. Minimize the maximum DCD_C. Both machines may be placed in the same restaurant. Output the minimum possible DD and the chosen restaurant numbers.

Input

The first line contains KK (1≤K≤21 \le K \le 2). The second line contains NN. Each of the next NN lines has coordinates XX and YY (0≤X,Y≤1060 \le X, Y \le 10^6). No two restaurants share a point.

Output

Print the minimum possible DD on the first line. On the second line print KK restaurant numbers separated by spaces.

Examples3

  1. Example 1

    Input
    2
    5
    1 1
    2 3
    5 10
    4 6
    7 12
    
    Expected output
    5
    1 3
    
  2. Example 2

    Input
    2
    10
    3 6
    1 4
    4 1
    4 7
    4 10
    3 8
    3 10
    6 7
    5 1
    2 10
    
    Expected output
    5
    1 3
    
  3. Example 3

    Input
    1
    10
    3 10
    6 1
    5 7
    0 4
    2 7
    2 0
    9 2
    4 1
    3 6
    1 4
    
    Expected output
    10
    3