#B3987. Friend Sequences
Friend Sequences
Friend Sequences
Little K likes sequences. Consider two sequences \(a\) and \(b\), both of length \(n\), where \(a_i\) denotes the \(i\)-th element of sequence \(a\) and \(b_i\) denotes the \(i\)-th element of sequence \(b\) for \(1\le i\le n\).
The two sequences are called friend sequences if there exists an integer \(S\) such that for every \(1\le i\le n\) the following equation holds:
\( a_i+b_i=S \)and additionally, every element satisfies \(-10^9\le a_i,b_i\le10^9\). Given the integer \(n\) and the sequence \(a\), your task is to construct a valid sequence \(b\) such that \(a\) and \(b\) are friend sequences.
Note: You can choose any valid integer \(S\) as long as for every \(i\), the element \(b_i=S-a_i\) lies within the range \([-10^9,10^9]\). A simple way is to choose \(S=min(a)+10^9\), where \(min(a)\) is the minimum element in sequence \(a\). With this choice, for every \(i\), \(b_i=S-a_i\) will satisfy the given constraints.
inputFormat
The first line contains an integer \(n\) (the length of the sequence). The second line contains \(n\) space-separated integers representing the sequence \(a\), where \(a_i\) is the \(i\)-th element of the sequence.
outputFormat
Output \(n\) space-separated integers representing the sequence \(b\) such that for every \(1\le i\le n\), \(a_i+b_i\) is a constant \(S\) and \(-10^9\le b_i\le10^9\).
sample
3
1 2 3
1000000000 999999999 999999998