結果
問題 |
No.1538 引きこもりさんは引き算が得意。
|
ユーザー |
|
提出日時 | 2022-10-22 12:32:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 674 bytes |
コンパイル時間 | 2,027 ms |
コンパイル使用メモリ | 195,236 KB |
最終ジャッジ日時 | 2025-02-08 11:07:36 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 42 WA * 12 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; using ll = long long; using ld = long double; int main(){ cin.tie(0); ios::sync_with_stdio(0); ll N,K; cin >> N >> K; vector<ll> A(N); rep(i,N) cin >> A[i]; rep(S,1<<N) if(S) { ll sum = 0; rep(i,N) if(S & (1 << i)) sum += A[i]; rep(i,N) if(S & (1 << i)) { ll x = sum - 2 * A[i]; if(__builtin_popcount(S) != 1 && x == K){ cout << "Yes" << endl; return 0; } x = 2 * A[i] - sum; if(x == K){ cout << "Yes" << endl; return 0; } } } cout << "No" << endl; return 0; }