結果
問題 | No.2155 みちらcolor |
ユーザー |
![]() |
提出日時 | 2022-12-09 21:30:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 19 ms / 2,000 ms |
コード長 | 831 bytes |
コンパイル時間 | 2,150 ms |
コンパイル使用メモリ | 199,140 KB |
最終ジャッジ日時 | 2025-02-09 07:23:14 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 64 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for (long long i=0;i<(long long)(n);i++) #define all(v) v.begin(),v.end() using ll=long long; using pll=pair<ll,ll>; using tll=tuple<ll,ll,ll>; const ll INF=(1ll<<60); template<class T> void chmin(T &a,T b){ if(a>b){ a=b; } } template<class T> void chmax(T &a,T b){ if(a<b){ a=b; } } int main(){ ll n,m,l; cin >> n >> m >> l; vector<ll> a(n); ll k=l; rep(i,n){ cin >> a[i]; k+=a[i]; } vector<vector<bool>> dp(n+1,vector<bool>(k+1,false)); dp[0][l]=true; rep(i,n){ rep(j,k){ if(dp[i][j]){ dp[i+1][j]=true; dp[i+1][(j+a[i])/2]=true; } } } if(dp[n][m]) cout << "Yes" << endl; else cout << "No" << endl; }