A group of people with heights is standing in a queue, with arbitrary order. They can see everyone in front (left) of them, until there is someone taller than them. For clarity, look at queue of people :
The circle represent their height and the number below them indicates the number of people they can see.
Starting from the first person, you ask them the question "How many people can you see standing in front of you?" and note down their response. When you are going to trace back their heights, you noticed that some information are wrong! That is, it's not possible for the person to see that number of people despite the sequence of heights in the queue. Given the responses, find the first (leftmost) information that is wrong.
1 |
|
If you think that the -rd person from the left is the one who gave wrong information, output your answer as . If all information are correct (possible to generate a sequence of heights), output your answer as .
You are encouraged to solve the Easy version of this problem first.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
She says that sees 6 but if she sees persons who see 2 than she sees next after him.