結果

問題 No.1594 Three Classes
ユーザー bdbmilk37bdbmilk37
提出日時 2021-07-10 09:29:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 902 bytes
コンパイル時間 2,108 ms
コンパイル使用メモリ 202,316 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-28 00:36:05
合計ジャッジ時間 2,739 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 3 ms
6,944 KB
testcase_04 AC 33 ms
6,940 KB
testcase_05 AC 34 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 33 ms
6,944 KB
testcase_09 AC 33 ms
6,944 KB
testcase_10 AC 32 ms
6,940 KB
testcase_11 AC 36 ms
6,940 KB
testcase_12 AC 33 ms
6,940 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 8 ms
6,940 KB
testcase_15 AC 6 ms
6,944 KB
testcase_16 AC 3 ms
6,940 KB
testcase_17 AC 3 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
// #include <atcoder/all>
// using namespace atcoder;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define quit(a) {cout << a << endl; return 0;}
using ll = long long;
using P = pair<int,int>;
// using mint = modint998244353;
// using mint = modint1000000007;
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1001001001;
const ll LINF = 1002003004005006007ll;


int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  rep(b,(int)pow(3,n)){
    vector<int> tot(3);
    int bi = b;
    rep(i,n) tot[bi%3] += a[i], bi /= 3;
    if ((tot[0] == tot[1]) && (tot[1] == tot[2])) quit("Yes");
  }
  cout << "No" << endl;
  return 0;
}
0