結果

問題 No.1538 引きこもりさんは引き算が得意。
ユーザー inksamurai
提出日時 2021-06-07 01:31:19
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,857 bytes
コンパイル時間 1,118 ms
コンパイル使用メモリ 115,572 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2024-11-23 23:33:08
合計ジャッジ時間 2,858 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 45 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <tuple>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <functional>
#include <numeric>
#include <iomanip> 
#include <stdio.h>
//eolibraries
#define lnf 3999999999999999999
#define inf 999999999
#define PI 3.14159265359
#define endl "\n"
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define ll long long
#define all(c) (c).begin(),(c).end()
#define sz(c) (ll)(c).size()
#define mkp(a,b) make_pair(a,b)
#define make_unique(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define rsz(a,n) a.resize(n)
#define pii pair <ll,ll>
#define rep(i,n) for(ll i = 0 ; i < n ; i++) 
#define drep(i,n) for(ll i = n-1 ; i >= 0 ; i--)
#define crep(i,x,n) for(ll i = x ; i < n ; i++)
#define vi vector <ll> 
#define vec(...) vector<__VA_ARGS__>
#define rsz(a,n) a.resize(n)
#define rszv(a,n,v) a.resize(n,v)
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
//eodefine
using namespace std;

const ll max_n = 103002;

ll n,k;
vi a;

int main(){
fcin;
	cin>>n>>k;	
	rep(i,n) { ll x; cin>>x; a.pb(x); }

	set <ll> sta,stb;

	sta.insert(0);

	rep(i,(n+1)/2) {
		set <ll> nesta = sta;
		for(auto x : sta) {
			nesta.insert(x+a[i]);
			nesta.insert(x-a[i]);
		}
		sta = nesta;
	}
	
	stb.insert(0);

	crep(i,(n+1)/2,n) {
		set <ll> nestb = stb;
		for(auto x : stb) {
			nestb.insert(x+a[i]);
			nestb.insert(x-a[i]);
		}
		stb=nestb;
	}
	
	function<void()> yp = [&]() {
		cout<<"Yes\n";
		exit(0);	
		return;
	};
	
	for(auto x : stb) {
		// cout<<x<<"\n";
		if(sta.find(k-x)!=sta.end()) yp();
		if(sta.find(x-k)!=sta.end()) yp();
	}
	
	cout<<"No\n";
/*
*/
 
    return 0;   
}
0