結果

問題 No.1538 引きこもりさんは引き算が得意。
ユーザー hiro71687khiro71687k
提出日時 2023-03-30 20:07:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 697 bytes
コンパイル時間 4,730 ms
コンパイル使用メモリ 272,920 KB
実行使用メモリ 813,896 KB
最終ジャッジ日時 2023-10-22 04:41:51
合計ジャッジ時間 21,036 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 WA -
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 WA -
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 2 ms
4,348 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 WA -
testcase_33 AC 2 ms
4,348 KB
testcase_34 AC 2 ms
4,348 KB
testcase_35 AC 2 ms
4,348 KB
testcase_36 AC 2 ms
4,348 KB
testcase_37 AC 1,567 ms
265,808 KB
testcase_38 AC 1,526 ms
265,808 KB
testcase_39 AC 484 ms
134,760 KB
testcase_40 AC 1,528 ms
265,808 KB
testcase_41 AC 1,529 ms
265,808 KB
testcase_42 AC 1,528 ms
265,808 KB
testcase_43 AC 7 ms
4,976 KB
testcase_44 AC 928 ms
167,524 KB
testcase_45 AC 1,936 ms
331,396 KB
testcase_46 AC 2 ms
4,348 KB
testcase_47 MLE -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll mod=1000000007;
ll inf=9999999999999999;
int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll>a(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    map<ll,ll>memo;
    vector<map<ll,ll>>dp(n+1);
    for (ll i = 0; i < n; i++)
    {
        dp[i+1]=dp[i];
        dp[i+1][a[i]]=1;
        for(auto v:dp[i]){
            dp[i+1][v.first-a[i]]=1;
            dp[i+1][a[i]-v.first]=1;
        }
    }
    if (dp[n][k]>=1)
    {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}
0