1251 : Memory
Time Limit: 1 Sec Memory Limit: 256 MB Submitted: 434 Solved: 100Description
\(\textit{Singing a song with cups of drink, That days are short is what I think. They are like dews in morning early, Therefore, I feel suffered for time gone surely.}\)
Little G used to be a participant in programming contests and he had attended \(n\) contests in total, and for the \(i\)-th contest, Little G got \(a_i\) happiness. However, Little G would also be influenced by past contests since memory also plays an important role to influence one’s mood. So we can use following formula to value Little G’s mood after the \(i\)-th contest: \[ Mood(i) = \sum_{j=1}^{i}2^{j-i}\times a_j\]
Now Little G is recalling the past and is curious about the moods
after every contest, so he wants to tag the moods for every contest.
Specifically, Little G will tag a positive sign (+
) for the
\(i\)-th contest if \(Mood(i) > 0\), or tag a negative sign
(-
) if \(Mood(i) < 0\),
or tag a zero (0
) if \(Mood(i) =
0\). But Little G is busy working and working, so he is now
asking you, the best programming contestant, to help him tag the
moods.
Input
The first line contains one integers \(n\) (\(1\le n\le 10^5\)), denoting the number of contests Little G had attended.
The second line contains \(n\) integers \(a_1, a_2, \ldots, a_n\) (\(-10^9 \le a_i \le 10^9\)), denoting the happiness values after every contest.
Output
Output one line containing a string which is of length \(n\) and only contains +
,
-
or 0
, denoting the mood tags after every
contest.
Sample
10 2 -1 4 -7 4 -8 3 -6 4 -7
+0+-+---+-
Hint
- \(Mood(1) = 2^0\times 2 = 2 > 0\)
- \(Mood(2) = 2^{-1}\times 2 + 2^0\times(-1) = 0\)
- \(Mood(3) = 2^{-2}\times 2 + 2^{-1}\times(-1) + 2^0\times 4 = 4 > 0\)
- \(Mood(4) = 2^{-3}\times 2 + 2^{-2}\times(-1) + 2^{-1}\times 4 + 2^0\times (-7) = -5 < 0\)
- \(Mood(5) = 2^{-4}\times 2 + 2^{-3}\times(-1) + 2^{-2}\times 4 + 2^{-1}\times (-7) + 2^0\times 4 = \frac{3}{2} > 0\)
Author
FUDAN