結果
問題 | No.1594 Three Classes |
ユーザー | JiKuai |
提出日時 | 2021-07-09 21:48:36 |
言語 | C++17 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 1,678 bytes |
コンパイル時間 | 2,385 ms |
コンパイル使用メモリ | 201,704 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-08-10 06:49:27 |
合計ジャッジ時間 | 2,974 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 5 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 2 ms
4,380 KB |
testcase_03 | AC | 2 ms
4,380 KB |
testcase_04 | AC | 6 ms
4,380 KB |
testcase_05 | AC | 6 ms
4,380 KB |
testcase_06 | AC | 1 ms
4,380 KB |
testcase_07 | AC | 1 ms
4,376 KB |
testcase_08 | AC | 5 ms
4,376 KB |
testcase_09 | AC | 5 ms
4,376 KB |
testcase_10 | AC | 6 ms
4,376 KB |
testcase_11 | AC | 6 ms
4,380 KB |
testcase_12 | AC | 6 ms
4,380 KB |
testcase_13 | AC | 1 ms
4,380 KB |
testcase_14 | AC | 2 ms
4,380 KB |
testcase_15 | AC | 2 ms
4,380 KB |
testcase_16 | AC | 2 ms
4,376 KB |
testcase_17 | AC | 2 ms
4,376 KB |
testcase_18 | AC | 1 ms
4,376 KB |
testcase_19 | AC | 2 ms
4,376 KB |
testcase_20 | AC | 1 ms
4,380 KB |
ソースコード
/* -------------- | / | | / | | / | * |/ | | ------ * | | | | / \ | | |\ | | | |\ | \ | | | \ | | | | \ | \ | | | \ | | \ / \ | V | | \ \__/| ----- \ | */ #include <bits/stdc++.h> using namespace std; #define debug(x) cerr << "\e[1;31m" << #x << " = " << (x) << "\e[0m\n" #define print(x) emilia_mata_tenshi(#x, begin(x), end(x)) template<typename T> void emilia_mata_tenshi(const char *s, T l, T r) { cerr << "\e[1;33m" << s << " = ["; while(l != r) { cerr << *l; cerr << (++l == r ? ']' : ','); } cerr << "\e[0m\n"; } #define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL); using ll = int64_t; using ull = uint64_t; using ld = long double; using uint = uint32_t; const double EPS = 1e-8; const int INF = 0x3F3F3F3F; const ll LINF = 4611686018427387903; const int MOD = 1e9+7; /*--------------------------------------------------------------------------------------*/ signed main() { EmiliaMyWife int n; cin >> n; vector<int> arr(n); for(int &a : arr) cin >> a; function<bool(int, int, int, int)> dfs = [&](int cur, int a, int b, int c) { if(cur == n) return a == b && b == c; return dfs(cur + 1, a + arr[cur], b, c) || dfs(cur + 1, a, b + arr[cur], c) || dfs(cur + 1, a, b, c + arr[cur]); }; cout << (dfs(0, 0, 0, 0) ? "Yes" : "No") << '\n'; }