C. Queue
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
In the Main Berland Bank n people stand in a queue at the cashier, everyone knows his/her height hi, and the heights of the other people in the queue. Each of them keeps in mind number ai — how many people who are taller than him/her and stand in queue in front of him.
After a while the cashier has a lunch break and the people in the queue seat on the chairs in the waiting room in a random order.
When the lunch break was over, it turned out that nobody can remember the exact order of the people in the queue, but everyone remembers his number ai.