Twinkle Twinkle Little Star

Time Limit:  4 s      Memory Limit:   64 MB
Submission:36     AC:7     Score:99.60


Twinkle, twinkle, little star, how I wonder what you are.

Up above the world so high, like a diamond in the sky.

Twinkle, twinkle, little star, how I wonder what you are.

When the blazing sun is gone, when he nothing shines upon.

The you show your little light, Twinkle, twinkle, little star

Twinkle, twinkle, little star, How I wonder what you are.

Twinkle, twinkle, little star, how I wonder what you are.

----<Twinkle, twinkle, little star.>

Well, this song may take us back to our childhood. When we were young, we often looked up at the stars. How amazing they were! But, unfortunately, as we are becoming older and older, what used to be interesting can not interest us now. So what we can do is to find something more interesting!

Here is one, maybe. Assume that all the stars are so far from us that we can treat them as points in a plane. You are given N stars in the plane, and a number K (0≤K≤N). What you need to do is to find the minimum square covering at least K stars, whose edges are all parallel to the axis. The stars which are on the edges of the square are also covered.


The input will consist of multiple cases. Your program should process to the end of the input file.In the first line of one case, there are two integer N and K, 0<N≤1500, 0≤K≤N.

The next N lines are the description of the stars, one star per line. The ith line consists of two integers Xi and Yi, |Xi|<1000000, |Yi|<1000000.


The output will consist of one line for each case, in the format of “Case X: Y”, while X is the case number counting from 1, and Y is the edge length of the minimum square. X and Y are all integers.


4 4 0 0 0 1 1 0 2 2 4 2 0 0 1 1 2 2 3 3
Case 1: 2 Case 2: 1


Huge input, scanf is recommended


3rd Central South China Programming Contest