The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 1 Day Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Some people think that the bigger an elephant is, the smarter it is. To disprove this,
you want to analyze a collection of elephants and place as large a subset of elephants
as possible into a sequence whose weights are increasing but IQ’s are decreasing.
The input will consist of data for a bunch of elephants, at one elephant per line terminated
by the end-of-file. The data for each particular elephant will consist of a pair of
integers: the first representing its size in kilograms and the second representing its IQ
in hundredths of IQ points. Both integers are between 1 and 10,000. The data contains
information on at most 1,000 elephants. Two elephants may have the same weight, the
same IQ, or even the same weight and IQ.
The only output line should contain an integer n, the length of elephant sequence
found.. If these sequence
of n elephants are a[1], a[2],..., a[n] then it must be the case that weight's of 1,2,3...n must be in strictly increasing order and iq's of 1,2,3,..n must be in strictly decreasing order.
In order for the answer to be correct, n must be as large as possible. All inequalities
are strict: weights must be strictly increasing, and IQs must be strictly decreasing.
Input: 6008 1300 6000 2100 500 2000 1000 4000 1100 3000 6000 2000 8000 1400 6000 1200 2000 1900 Output: 4
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll