Problem F
Who's the Boss?
Several surveys indicate that the taller you are, the higher you can climb the corporate ladder. At TALL Enterprises Inc., this “de facto standard” has been properly formalized: your boss is always at least as tall as you are. Furthermore, you can safely assume that your boss earns a bit more than you do. In fact, you can be absolutely sure that your immediate boss is the person who earns the least among all the employees that earn more than you and are at least as tall as you are. Furthermore, if you are the immediate boss of someone, that person is your subordinate, and all of his or her subordinates are your subordinates as well. If you are nobody’s boss, then you have no subordinates. As simple as these rules are, many people working for TALL are unsure of to whom they should be turning in their weekly progress report and how many subordinates they have. Write a program that will help in determining for any employee who the immediate boss of that employee is and how many subordinates they have. Quality Assurance at TALL have devised a series of tests to ensure that your program is correct. These test are described below.
Input
On the first line of input are two positive integers
The salary is a positive integer which is at most
Output
For each employee ID
Sample Input 1 | Sample Output 1 |
---|---|
3 3 123456 14323 1700000 123458 41412 1900000 123457 15221 1800000 123456 123458 123457 |
123457 0 0 2 123458 1 |
Sample Input 2 | Sample Output 2 |
---|---|
4 4 200002 12234 1832001 200003 15002 1745201 200004 18745 1883410 200001 24834 1921313 200004 200002 200003 200001 |
200001 2 200004 0 200004 0 0 3 |