2719. Hell on the Markets

单点时限: 2.0 sec

内存限制: 256 MB

Most financial institutions had become insolvent during financial crisis and went bankrupt or were boughtby larger institutions, usually by banks. By the end of financial crisis of all the financial institutions only two banks still continue to operate. Financial markets had remained closed throughout the crisis andnow regulators are gradually opening them. To prevent speculation and to gradually ramp up trading they will initially allow trading in only one financial instrument and the volume of trading will be limited to contracts for -th minute of market operation.

Two banks had decided to cooperate with the government to kick-start the market operation. The boards of directors had agreed on trading volume for each minute of this first trading session. One bank willbe buying contracts () during -th minute (), while the other one will be selling. They do not really care whether to buy or to sell, and the outside observer will only see the volume of contracts traded per minute. However, they do not want to take any extra risk and want to have no position in the contract by the end of the trading session. Thus, if we define when the first bank is buying and when the second one is buying (and the first one is selling), then the requirementfor the trading session is that .

Your lucky team of three still works in the data center (due to the crisis, banks now share the data centerand its personnel) and your task is to find such or to report that this is impossible.

输入格式

The first line of the input file contains the single integer number ().

The second line of the input file contains n integer numbers – ().

输出格式

The first line of the output file must contain Yes if the trading session with specified volumes is possibled and No otherwise. In the former case the second line must contain numbers – .

样例

Input
4
1 2 3 4
Output
Yes
-1 1 1 -1
Input
4
1 2 3 3
Output
No

15 人解决,23 人已尝试。

23 份提交通过,共有 51 份提交。

5.2 EMB 奖励。

创建: 11 年,1 月前.

修改: 2 年前.

最后提交: 1 年,10 月前.

来源: NEERC 2008

题目标签