結果

問題 No.1538 引きこもりさんは引き算が得意。
ユーザー hiro71687k
提出日時 2023-03-30 19:57:56
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 696 bytes
コンパイル時間 21,998 ms
コンパイル使用メモリ 325,176 KB
最終ジャッジ日時 2025-02-11 19:12:22
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34 WA * 4 TLE * 16
権限があれば一括ダウンロードができます

ソースコード

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;
    for (ll i = 0; i < n; i++)
    {
        map<ll,ll>dp;
        for(auto v:memo){
            dp[v.first]+=1;
            dp[v.first-a[i]]+=1;
            dp[a[i]-v.first]+=1;
        }
        dp[a[i]]+=1;
        memo=dp;
    }
    if (memo[k]>=1)
    {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}
0