Piloti
Mirko acquired airline transport company and to stay in business he needs to lower the expenses by any means possible. There are N pilots working for his company (N is even) and N/2 plane crews needs to be made. A plane crew consists of two pilots - a captain and his assistant. A captain must be older than his assistant. Each pilot has a contract granting him two possible salaries - one as a captain and the other as an assistant. A captain's salary is larger than assistant's for the same pilot. However, it is possible that an assistant has larger salary than his captain. Write a program that will compute the minimal amount of money Mirko needs to give for the pilots' salaries if he decides to spend some time to make the optimal (i.e. the cheapest) arrangement of pilots in crews.
4
5000 3000
6000 2000
8000 1000
9000 6000Output:
190006
10000 7000
9000 3000
6000 4000
5000 1000
9000 3000
8000 6000Output:
32000Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.