CTU Open Contest 2017 - Punching Power

View as PDF

Submit solution

Points: 15
Time limit: 1.4s
Memory limit: 256M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

The park management finally decided to install some popular boxing machines at various strategic places in the park. In fact, to compensate for the previous lack of machines, they decided to install as many machines as possible. Surprisingly enough, the park is not going to be choked with new machines because there are some quite serious legal limitations regarding the locations of the machines. The management has marked all possible boxing machine locations and their respective coordinates on the park plan. Additionally, they also have to respect manufacturer security rule: The distance between any two boxing machines has to be at least 1.3 meters.

Help the management to establish the maximum possible number of boxing machines which can be installed in the park.

Input Specification

There are several test cases. Each case starts with a line containing one integer N which specifies the number of possible boxing machine locations in the park (1 \le N \le 2000). Next, there are N lines representing the location coordinates, each line describes one location by a pair of integer coordinates in meters. All locations in one test case are unique. Each coordinate is non-negative and less than or equal to 10^9.

You are guaranteed that all locations form a single connected group, that is, it is possible to start in any location and reach any other location by a sequence of steps, each of which changes exactly one coordinate by 1, without leaving the area suitable for placing boxing machines.

Output Specification

For each test case, print a single line with one integer representing the maximum number of boxing machines which can be installed in the park.

Sample Input

0 0
0 1
1 0
1 1
0 1
1 0
1 1
1 2
1 3
2 2

Sample Output

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported


  • 1
    zxyl  commented on July 24, 2018, 4:31 p.m.

    What are the constraints on the number of test cases?