問題一覧 > 通常問題

No.2812 Plus Minus Blackboard

レベル : / AI推定難易度 : 1325 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 85
作問者 : Yoyoyo8128 / テスター : hirayuu_yc Magentor warabi0906 highlighter zeta7532
お気に入りにしたユーザー ProblemId : 11004 / 自分の提出
問題文最終更新日: 2024-07-19 21:19:28
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 437 ('09 Contest 002 day2) (順位表) の他の問題:

Problem Statement

You are given an integer sequence $A=(A_1,A_2,\dots,A_N)$ of length $N$.

You may perform the following operation any number of times.

  • Choose a pair $(i,j)$ of distinct integers between $1$ and $|A|$, inclusive. Here, $A_i\leq 0$ ,$A_j\geq 0$ must hold. Append $A_i+A_j$ to the end of $A$, and then simultaneously delete the $i$-th and $j$-th elements from $A$.

Determine whether it is possible to make the number of elements of $A$ equal to $1$.

Constraints

  • $1\leq N\leq 2\times 10^5$
  • $-10^9\leq A_i\leq 10^9$
  • All input values are integers.

Input

$N$
$A_1\ A_2\dots A_N$

Output

Print Yes if the number of elements of $A$ can be made equal to $1$, and No otherwise.

Sample

Sample 1
Input
2
3 5
Output
No

The operation cannot be performed with either $i=1,j=2$ or $i=2,j=1$.

Sample 2
Input
3
-45 8 10
Output
Yes

The goal can be achieved as follows.

  • Perform the operation with $i=1,j=2$. $A=(10,-37)$ results.
  • Perform the operation with $i=2,j=1$. $A=(-27)$ results.

Sample 3
Input
5
-1000000000 -100000000 -10000000 -1000000 1000000000
Output
Yes

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。