結果
問題 | No.1594 Three Classes |
ユーザー |
|
提出日時 | 2021-07-09 22:41:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 565 bytes |
コンパイル時間 | 2,195 ms |
コンパイル使用メモリ | 195,932 KB |
最終ジャッジ日時 | 2025-01-22 22:20:11 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0; i < (int)n; i++) using ll = long long; int main(){ int n; cin >> n; vector<int> e(n); rep(i,n) cin >> e[i]; vector<int> p(3); auto dfs = [&](auto&& self, int id) -> bool { bool can = false; if(id == n) { if(p[0] == p[1] and p[1] == p[2]) return true; return false; } rep(i,3) { p[i] += e[id]; if(self(self,id+1)) can = true; p[i] -= e[id]; } return can; }; cout << (dfs(dfs,0) ? "Yes" : "No") << endl; return 0; }