結果

問題 No.2155 みちらcolor
ユーザー take000
提出日時 2022-12-09 21:37:03
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 583 bytes
コンパイル時間 2,073 ms
コンパイル使用メモリ 198,492 KB
最終ジャッジ日時 2025-02-09 07:34:26
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 64
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0)->sync_with_stdio(0);

    int N, M, L;
    cin >> N >> M >> L;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    vector<bool> dp(1001);
    dp[L] = true;

    rep(i, N) {
        vector<bool> next = dp;
        rep(j, 1001) {
            if (dp[j]) {
                next[(j + A[i]) / 2] = true;
            }
        }
        dp = next;
    }

    if (dp[M])
        cout << "Yes\n";
    else
        cout << "No\n";

    return 0;
}
0