Every year at West Bartholomew University, a pancake sorting competition is held. The rules vary each year to add to the excitement during the Christmas Period. You might note that in 1979, a rather famous buisness man, William Gates, have won it along with Papadimitriou. It's a rather prestigious competition.
This year, Proffessor Nottle had the opportunity to organise this prestigious event. She had decided the rules as follows. You are allowed to flip a stack of pancakes if they are next to each other. For example:
1 2 3 4 5
Flipping within index 1 and 3 will result in
1 4 3 2 5
(Note that they are 0-indexed). The winner of the competition is decided by whoever uses the least amount of flips.
There will be one integer N, followed by N lines containing one integer of various pancake sizes.
You are to supply a list of flips in order to sort the list such that it goes from smallest to biggest.
1 3 2 5 4
It allows the flip on pancake at index 1 to index 2. Thus creating a sorted list.
Your score will be graded linearly per test case. 100 will be awarded to the top scorer (least flips), and 0 will be awarded to the person with N flips.
This will be implemented manually so your score for this question is not finalized until after the contest.