Codeforces Round 569 (Div. 2)
B
Nick and Array
Codeforces
1500
原题
← AC →
翻译中…

Nick had received an awesome array of integers $a=[a_1, a_2, \dots, a_n]$ as a gift for his $5$ birthday from his mother. He was already going to explore its various properties but after unpacking he was disappointed a lot because the product $a_1 \cdot a_2 \cdot \dots a_n$ of its elements seemed to him not large enough.

翻译中…

He was ready to throw out the array, but his mother reassured him. She told him, that array would not be spoiled after the following operation: choose any index $i$ ($1 \le i \le n$) and do $a_i := -a_i - 1$.

翻译中…

For example, he can change array $[3, -1, -4, 1]$ to an array $[-4, -1, 3, 1]$ after applying this operation to elements with indices $i=1$ and $i=3$.

翻译中…

Kolya had immediately understood that sometimes it's possible to increase the product of integers of the array a lot. Now he has decided that he wants to get an array with the maximal possible product of integers using only this operation with its elements (possibly zero, one or more times, as many as he wants), it is not forbidden to do this operation several times for the same index.

翻译中…

Help Kolya and print the array with the maximal possible product of elements $a_1 \cdot a_2 \cdot \dots a_n$ which can be received using only this operation in some order.

翻译中…

If there are multiple answers, print any of them.

翻译中…

Input

翻译中…

The first line contains integer $n$ ($1 \leq n \leq 10^{5}$) — number of integers in the array.

翻译中…

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($-10^{6} \leq a_i \leq 10^{6}$) — elements of the array

翻译中…

Output

翻译中…

Print $n$ numbers — elements of the array with the maximal possible product of elements which can be received using only this operation in some order from the given array.

翻译中…

If there are multiple answers, print any of them.

翻译中…

样例

Input #1
4
2 2 2 2
Output #1
-3 -3 -3 -3
InputCopy OutputCopy
Input #2
1
0
Output #2
0
InputCopy OutputCopy
Input #3
3
-3 -3 2
Output #3
-3 -3 2
InputCopy OutputCopy
题目信息
题号
1180B
时间限制
1 s
内存限制
256 MB
标签
贪心
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。