2009 Bulgarian Olympiad in Informatics
The frog-mutants in the metropolitan region have lost their mind. After years in the garbage, they are looking for a better life.
The boulevard they are living on is now fully covered with garbage
bales. In particular, there are
On each of the bales there is a frog that is very tired and can only
make up to
Input Specification
On the first line is the number of bales
On the second line the
Output Specification
Output
Sample Input 1
8
3 1 4 5 6 2 3 8
1 2 1 3 4 2 1 2
Sample Output 1
4 5 5 -1 -1 8 8 -1
Sample Input 2
6
7 8 9 1 2 3
2 2 2 2 2 2
Sample Output 2
9 -1 -1 3 -1 -1
Comments
https://dmoj.ca/problem/btoi07p3#comment-13823
This applies here as well.