atcoder#ARC128A. [ARC128A] Gold and Silver
[ARC128A] Gold and Silver
Score : points
Problem Statement
Snuke has gram of gold and grams of silver now. He will do trading of gold and silver for the following days. On each day, he has two choices: do nothing, or make a trade. If he trades on Day (), the following will happen.
- If he has grams of gold before the trade, exchange all of it for grams of silver. On the other hand, if he has grams of silver, exchange all of it for grams of gold.
Snuke's objective is to maximize the amount of gold he has in the end. Find one way to achieve his objective.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer in the following format:
Here, is an integer representing the action on Day (). means he does nothing, and means he makes a trade. If there are multiple possible solutions, printing any of them will be considered correct.
3
3 5 2
0 1 1
The optimal sequence of actions is as follows.
- Day : Do nothing.
- Day : Exchange gram of gold for grams of silver.
- Day : Exchange grams of silver for grams of gold.
4
1 1 1 1
0 0 0 0
, for example, is also considered correct.
10
426877385 186049196 624834740 836880476 19698398 709113743 436942115 436942115 436942115 503843678
1 1 0 1 1 1 1 0 0 0