結果

問題 No.2155 みちらcolor
ユーザー ymmtr(せるたわーしーぷ!)ymmtr(せるたわーしーぷ!)
提出日時 2022-12-09 21:44:36
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 693 bytes
コンパイル時間 1,900 ms
コンパイル使用メモリ 172,752 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-14 21:23:04
合計ジャッジ時間 4,192 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 64
権限があれば一括ダウンロードができます

ソースコード

diff #

//C
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
using ll = long long;
#define ALL(a)  (a).begin(),(a).end()
using v_vll = vector<vector<ll>>;
int main(){
    ll n,m,l;cin>>n>>m>>l;
    vector<ll> a(n+1);
    for(ll i=1;i<=n;i++){
        cin>>a[i];
    }
    v_vll dp(n+5,vector<ll>(1e3+10));
    dp[0][l]=true;
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<=1000;j++){
            if(dp[i-1][j]){
                dp[i][j]=true;
                if((j+a[i])/2<=1000){
                    dp[i][(j+a[i])/2]=true;
                }
                
            }
        }
    }
    if(dp[n][m]){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}
0