12753 - Go on mission   

Description

This is a partial judge problem.

 

In Taisho-era Japan, demons hunt for human during night time. Therefore, Kisatsutai (鬼殺隊) sents demon slayers to protect the villagers. Tanjiro, Zenitsu, Inosuke are demon slayers who train themselves in Chouyashiki (蝶屋敷). Whenever there is a mission, Kisatsutai sents the one with highest health condition among the three. If their health condition are the same, the order of going on a mission is Inosuke > Tanjiro > Zenitsu. Initially, three of them have the same health condition. After they finish a mission, their health condition may compromise and need to rest and train themselves in Chouyashiki.

Their health condition is represented with a very big integer (<= 101200). Also, their health condition may be negative (but it is still okay to go on a mission).

Given the number of mission and how much health condition will be compromised in each mission, output each person's health condition after they finish all missions.

This is a partial judge problem. Inside function.h, there is a BigInt class for storing very big integer and a solution function to calculate the answer. Please choose C++11 compiler when submitting.

Explanation of Sample IO

Initially, three of them have equal health condition 71227122712271227122, and there are three missions.

For the first mission, Inosuke will go because he has highest order when they have same condition. After the mission, his health condition becomes 71227122712271227122 - 123456789987654321 = 71103665922283572801.

For the second mission, Tanjiro and Zenitsu have higher health condition. Tanjiro will go because he has high order than Zenitsu when they have same health condition. After the mission, his health condition becomes 71227122712271227122 - 91879487948794879487 = -20652365236523652365.

For the third mission, Zenitsu will go because he has the highest health condition. After the mission, his health condition becomes 71227122712271227122 - 7122712200000000 = 71220000000071227122.

 

Input

The first line is an integer N, begin the number of mission.

The second line is an integer H, begin the initial health condition of the three.

After that, there are N lines. The i-th line is an integer ci, meaning that the health condition of the one going on the i-th mission will be compromised by ci.

It is guaranteed that :

  • N <= 2000

  • 0 <= H, ci <= 101200

  • -101200 < health condition < 101200, which means the health condition won't overflow the BigInt class.

Output

Please output three integers, each in a line.

The first integer is Tanjiro's health condition, the second integer is Zenitsu's, and the third is Inosuke's.

Note that there should not be trailing zeros or sign. For example, if the health condition is 87, you shouldn't print something like 00...0087; if the health is 0, you should print 0 instead of -0.

Sample Input  Download

Sample Output  Download

Partial Judge Code

12753.cpp

Partial Judge Header

12753.h

Tags




Discuss