Time limit
2s
Memory limit
128 MB
Sevi Game is played by two players with five six-sided dice.
First, player 1 rolls all five dice. Then player 2 chooses at least two of those dice and makes player 1 reroll them. Player 2 wants the expected score after the reroll to be as small as possible.
The score of the final five dice is the maximum score among all satisfied categories below. If no category is satisfied, the score is 0.
1 2 3 4 5 and 2 3 4 5 6.Given the four category scores and player 1's initial dice, choose the dice that player 2 should reroll so that player 1's expected score is minimized.
The first line contains four scores, in order: Sevi, Sevi straight, straight, and full house.
The second line contains the five values initially rolled by player 1, in input order. Each score is an integer at least 0 and less than 10000. Each die value is an integer from 1 to 6.
On the first line, print the number k of dice to reroll. On the second line, print the chosen die indices in increasing order. The dice are numbered from 1 to 5 in input order.
If several choices have the same expected score, print the choice whose output sequence (k, i1, i2, ..., ik) is lexicographically smallest.
In the first public test, rerolling four dice increases the chance of a straight or a full house. Rerolling three dice is therefore optimal. Any three dice give the same expected score, so the lexicographically smallest choice is 1 2 3.