Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Circle of Boltu

By sayedalmahdi · Limits 1s, 512 MB

Boltu and Poltu are two best friends. Boltu loves to play games in computer. When class is off, instead of going out, he sits in front of his gaming PC and plays for hours. But, Poltu is totally opposite. He likes his body to be fit. So, he plays outside and burns his fat.

For the lack of exercises, Boltu is getting Botlu day by day. Being worried, Poltu starts thinking of ideas. As Boltu likes geometry, he made some big circles in his playing field and tells him to run on them. Seeing the circles Boltu gets curious. “Of all circles, what is the maximum distance among any two of them?” - he thinks.

He has a strange way to calculate distances. He measures the distance and then takes square of it (ex: if the original distance between the center of two circles is 5 units, he calculates it as 25 units ).

At some point Boltu becomes tired and stops thinking. Now, he asks for your help to complete his calculation.


Input will start with an integer T ( 1 ≤ T ≤ 10 ), the number of test cases. Next T case(s) will have an Integer N ( 2 ≤ N ≤ 100 ), denoting number of circles in the field. Next N line(s) will have 2 integers, X and Y ( -10^5 ≤ X, Y ≤ 10^5 ), the co-ordinate of the center of the circles.


For each test cases print a single line “Case X: Y”, where X is the case number and Y is the maximum possible distance between any pair of circles.


0 0
1 0
0 1
1 1
Case 1: 2



80% Solution Ratio

sayedgkmEarliest, Jul '17

rubbyEFastest, 0.0s

Mili290Lightest, 0 B

trigger_uint32Shortest, 225B


Login to submit


We know, distance between two 2D co-ordinate is sqrt( (x1 - x2) ^2 + (y1 - y2)^2 ). As Boltu takes s...