結果

問題 No.1538 引きこもりさんは引き算が得意。
ユーザー rogi52rogi52
提出日時 2022-10-22 12:32:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 674 bytes
コンパイル時間 1,983 ms
コンパイル使用メモリ 200,252 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-14 07:40:31
合計ジャッジ時間 7,317 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 WA -
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 WA -
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 2 ms
4,384 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 1 ms
4,380 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 1 ms
4,380 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 202 ms
4,380 KB
testcase_38 AC 202 ms
4,376 KB
testcase_39 AC 201 ms
4,376 KB
testcase_40 AC 100 ms
4,380 KB
testcase_41 AC 101 ms
4,376 KB
testcase_42 AC 202 ms
4,376 KB
testcase_43 AC 2 ms
4,380 KB
testcase_44 WA -
testcase_45 AC 201 ms
4,376 KB
testcase_46 AC 200 ms
4,380 KB
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 AC 101 ms
4,380 KB
testcase_51 AC 202 ms
4,380 KB
testcase_52 WA -
testcase_53 WA -
testcase_54 AC 203 ms
4,384 KB
testcase_55 WA -
testcase_56 AC 202 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0