結果

問題 No.1538 引きこもりさんは引き算が得意。
ユーザー pepper_aobutapepper_aobuta
提出日時 2021-05-21 22:27:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 664 bytes
コンパイル時間 1,714 ms
コンパイル使用メモリ 168,692 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-02 11:59:05
合計ジャッジ時間 6,400 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    int n;
    cin >> n;
    ll k;
    cin >> k;
    ll a[n];
    for(int i = 0 ; i < n ; i++)cin >> a[i];
    
    for (int bit = 0; bit < (1<<n); ++bit) {
        ll check = 0;
        vector<int> S;
        for (int i = 0; i < n; ++i) {
            if (bit & (1<<i)) { // 列挙に i が含まれるか
                S.push_back(i);
            }
        }

        for (int i = 0; i < (int)S.size(); ++i) {
            check += a[S[i]];
        }
        
        if(check == k){
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}
0