# Large foot = High IQ?

Some people think that the bigger the size of a person's foot,the smarter he/she is. To disprove this,you want to analyze a collection of foot size/IQ measurements from $$1000$$ different people. You do this because you want to place as large a subset of people as possible into a sequence whose foot sizes are increasing but IQs are decreasing.

The following $$1000$$ line text file contains the data of the $$1000$$ test subjects.

Find the length $$N$$ of the largest subset of people in a sequence such that their foot sizes are strictly increasing and IQ is strictly decreasing.

Details and assumptions

• Each line in the text file contains a string $$(a,b)$$ where $$a$$ is the length of the subject's foot and $$b$$ is his\her IQ.

• Two people may have the same foot size, the same IQ, or even the same foot size and IQ.

• All the measurements between $$1$$ and $$10^4$$ assume this is because weird units were used.

Sample Input

If the following (foot size, IQ data) for four people was given
1. (108,169)
2. (188,249)
3. (284,140)
4. (104,275)

The largest possible subset of people into a sequence whose foot size's are increasing but IQs are decreasing would be $$(104,275)\rightarrow (188,249)\rightarrow(284,140)$$ . And thus the length of the sequence $$N$$ would be $$3$$.

Inspired from UVA problem

×