#ifdef __LOCAL #define _GLIBCXX_DEBUG #endif #include using namespace std; using ll = long long; using P = pair; using PIL = pair; using PLI = pair; using PLL = pair; template bool chmin(T &a, T b) {if(a>b){a=b;return 1;}return 0;} template bool chmax(T &a, T b) {if(a void show_vec(T v) {for (int i=0;i void show_pair(T p) {cout< bool judge_digit(T bit,T i) {return (((bit&(1LL< h_idx4 = {-1, 0,0,1}; const vector w_idx4 = { 0,-1,1,0}; const vector h_idx8 = {-1,-1,-1, 0,0, 1,1,1}; const vector w_idx8 = {-1, 0, 1,-1,1,-1,0,1}; // a^n // オーバーフローに注意 ll int_Pow(ll a,ll n){ ll res = 1; while (n > 0){ if (n & 1) res *= a; a = a * a; n >>= 1; } return res; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15); ll n; cin >> n; vector e(n); for (int i = 0; i < n; i++){ cin >> e[i]; } bool possible = false; for (ll i = 0; i < int_Pow(3LL,n); i++){ vector s(3,0); ll x = i; for (int j = 0; j < n; j++){ s[x % 3] += e[j]; x /= 3; } if (s[0] == s[1] && s[1] == s[2]){ possible = true; break; } } YesNo(possible); }