問題一覧 > 通常問題

No.1594 Three Classes

レベル : / AI推定難易度 : 425 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 366
作問者 : e869120 / テスター : kaage ygussany
お気に入りにしたユーザー ProblemId : 6416 / 自分の提出
問題文最終更新日: 2021-07-08 23:25:19
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
競プロ典型 90 問 期末試験 (順位表) の他の問題:

Problem Statement

The third-year class of yuki High School consists of $N$ students, numbered $1, 2, \dots, N$.
Each student has a value called combat power, and the combat power of student $i$ is $E_i$.

Is it possible to divide the $N$ students into $3$ classes (Class A, Class B, and Class C) so that the following condition is satisfied?

  • Let $P_A$ be the total combat power of the students belonging to Class A.
  • Let $P_B$ be the total combat power of the students belonging to Class B.
  • Let $P_C$ be the total combat power of the students belonging to Class C.
  • Then, $P_A = P_B = P_C$ holds.

Input

$N$
$E_1$ $E_2$ $E_3$ $\dots$ $E_N$

Output

Print Yes if it is possible to divide the students into $3$ classes so that the condition is satisfied, and No otherwise.

Constraints

  • $3 \leq N \leq 12$
  • $1 \leq E_i \leq 10^7$
  • All input values are integers.

Sample

Sample 1
Input
5
1 2 3 4 5
Output
Yes

If the students are divided as follows, the "total combat power" of every class is $5$.

  • Class A: consists of student $1$ and student $4$.
  • Class B: consists of student $2$ and student $3$.
  • Class C: consists of student $5$ only.

Sample 2
Input
7
3 1 4 1 5 9 2
Output
No
Sample 3
Input
9
729 756 767 778 792 804 816 831 855
Output
Yes

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