結果
| 問題 | No.1594 Three Classes | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-07-09 22:15:37 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 13 ms / 2,000 ms | 
| コード長 | 1,869 bytes | 
| コンパイル時間 | 1,099 ms | 
| コンパイル使用メモリ | 91,484 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-16 08:18:38 | 
| 合計ジャッジ時間 | 1,563 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 18 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <cmath>
#include <tuple>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#define flush fflush(stdout)
#define endl '\n'
#define all(v) v.begin(), v.end()
#define pf(dans) printf("%.12lf", dans)
#define pfn(dans) pf(dans); cout << endl;
using namespace std;
//using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;
const int mod1 = (int)1e9 + 7, mod2 = (int)998244353;
const int INF = (int)1e9 + 10;
const ll LINF = (ll)1e18 + 10;
const int di[8] = {1, 0, -1, 0, 1, 1, -1, -1}, dj[8] = {0, 1, 0, -1, -1, 1, -1, 1};
#define rep0(i, n) for (i = 0; i < n; i++)
#define rep1(i, a, b) for (i = a; i < b; i++)
#define reprev(i, n) for (i = n - 1; i >= 0; i--)
template <typename T>
T my_abs(T x){
    return (x >= 0)? x : -x;
}
template <typename T>
void chmax(T &a, T b){
    a = max(a, b);
}
template <typename T>
void chmin(T &a, T b){
    a = min(a, b);
}
ll gcd(ll a, ll b){
    if (a > b) return gcd(b, a);
    if (a == 0) return b;
    return gcd(b % a, a);
}
bool incld_bit(ll bit, int i){
    return ((bit>>i) & 1) == 1;
}
// --------------------------------------------------------------------------------
int main(void){
    int i, j;
    int n;
    int e[15];
    cin >> n;
    rep0(i, n){
        cin >> e[i];
    }
    int pow3_n;
    pow3_n = 1;
    rep0(i, n){
        pow3_n *= 3;
    }
    int bit3, bk;
    rep0(bit3, pow3_n){
        int scsum[3] = {};
        bk = bit3;
        rep0(i, n){
            scsum[bk % 3] += e[i];
            bk /= 3;
        }
        if (scsum[0] == scsum[1] && scsum[1] == scsum[2]){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}
            
            
            
        