5. Circus

Circus acrobats are standing on each other's shoulders to create a tower (there will be only one acrobat on each level in the tower). For aesthetic and practical reasons, one person's shoulders can stand only lower and lighter acrobat. Our task is to determine the number of participants in the tower with the most possible number of people.

In the file acrobat.py we have provided an example program that reads the acrobats from the file named in the command line argument, and then orders them non-incrementally. Every line of the file contains two numbers, the height and weight of an acrobat.

The function read_acrobats reads the data of acrobats and returns with the list of Acrobat class instances. The acrobats have the identifier, height and weight attributes and a may_stand_on method, which determines whether an acrobat can stand on an another one.

Use Dynamic Programming to determine the number of the most people in the tower complying with the rules. Write out the resulting number to the terminal. Let you try the program with the following inputs. We have also given the number of the most possible people in the tower:

Input Max tower
acrobat1.text 2
acrobat2.text 3
acrobat3.text 1
acrobat4.text 100
acrobat5.text 15
acrobat6.text 37