22103_HellontheMarkets

2022-5-16 18:21| 发布者: Hocassian| 查看: 26| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89506112069100-Problem List-采集的数据-后羿采集器.html

Pro.ID

22103

Title

Hell on the Markets

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22103

AC

0

Submit

1

Ratio

0.00%

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    Most financial institutions had become insolvent during financial crisis and went bankrupt or were bought by 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 and now regulators are gradually opening them. To prevent speculation and to gradually ramp up trading they will initially allow trading in only one fi nancial instrument and the volume of trading will be limited to i contracts for i-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 will be buying ai contracts (1 ≤ aii) during i-th minute (1 ≤ in), 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 ai 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 bi = 1 when the first bank is buying and bi = -1 when the second one is buying (and the first one is selling), then the requirement for 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 center and its personnel) and your task is to find such bi or to report that this is impossible.

    输入

    The first line of the input file contains the single integer number n (1 ≤ n ≤ 100000).

    The second line of the input file contains n integer numbers --- ai (1 ≤ aii).

    输出

    Description

    Most financial institutions had become insolvent during financial crisis and went bankrupt or were bought by 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 and now regulators are gradually opening them. To prevent speculation and to gradually ramp up trading they will initially allow trading in only one fi nancial instrument and the volume of trading will be limited to i contracts for i-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 will be buying ai contracts (1 ≤ aii) during i-th minute (1 ≤ in), 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 ai 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 bi = 1 when the first bank is buying and bi = -1 when the second one is buying (and the first one is selling), then the requirement for 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 center and its personnel) and your task is to find such bi or to report that this is impossible.

    Input

    The first line of the input file contains the single integer number n (1 ≤ n ≤ 100000).

    The second line of the input file contains n integer numbers --- ai (1 ≤ aii).

    Output

    The first line of the output file must contain "Yes" if the trading session with specified volumes is possible and "No" otherwise. In the former case the second line must contain n numbers ---- bi.

    Sample Input

    Sample #1
    4
    1 2 3 4


    Sample #2
    4
    1 2 3 3

    Sample Output

    Sample #1
    Yes
    1 -1 -1 1


    Sample #2
    No

    Source

    样例输入

    Sample #1
    4
    1 2 3 4


    Sample #2
    4
    1 2 3 3

    样例输出

    Sample #1
    Yes
    1 -1 -1 1


    Sample #2
    No

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部