Povisice
Mirko is a proud founder of a big software company. Initially he was the only worker in the company, but as the business grew, company hired N additional workers, one by one. We will denote Mirko with integer 0, and each of the remaining worker with integers 1 to N in order they were hired. On the first day of work every worker was assigned as a subordinate to another worker. Also, every worker was assigned with initial salary. However, if the salary of the new worker was greater than the salary of his boss, then his boss also got a raise to equal their salaries. If the boss of the new worker now has a greater salary than his boss, the procedure is repeated until every worker has a salary that is less than or equal to the salary of his boss. Write a program that will determine the number of workers that got a raise during the process of hiring
each new worker.
7
5000
4500 0
6000 0
4000 1
5500 3
7000 4
6300 2
6300 2Output
0
1
0
2
4
1
0Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.