oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

flip Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

flip.html

Problem Description

Jianzhi is playing with arrays today. He first generates an integer array A, of length N, in his mind.

He decides this array is too boring, so he decides to flip it. He generates a new array B, where the element Bi is the sum of all elements in A, excluding Ai.

Given the array B, Jianzhi wonders if you can find the array A. It is guaranteed that at least one such array exists.

Limits

Subtask 1 (19%): 2 ≤ N ≤ 2000, 1 ≤ Ai ≤ 106.

Subtask 2 (23%): 2 ≤ N ≤ 2000. |Ai| ≤ 106.

Subtask 3 (27%): 2 ≤ N ≤ 500000, 1 ≤ Ai ≤ 106.

Subtask 4 (31%): 2 ≤ N ≤ 500000, |Ai| ≤ 106.

Subtask 5 (0%): Sample Testcases.

Do take note that the integers in array B will exceed the size of an int.

Input

The first line of input will contain one integer, N.

The second line of input will contain N integers, representing the array B.

Output

The output should contain N integers, one on each line, representing the array A.

Sample Testcase 1

Input

3
4 5 3

Output

2
1
3

Sample Testcase 2

Input

4
-15 -3 -12 0

Output

5
-7
2
-10

Tags

Ad Hoc

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
119211s256MBMinimum
223421s256MBMinimum
327411s256MBMinimum
431821s256MBMinimum
5021s256MBMinimum

Judge Compile Command

g++-8 ans.cpp -o flip -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.