結果

問題 No.1238 選抜クラス
ユーザー kcz146
提出日時 2020-09-25 23:08:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 658 bytes
コンパイル時間 1,962 ms
コンパイル使用メモリ 195,612 KB
最終ジャッジ日時 2025-01-14 21:30:05
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 6 WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll = long long int;
using lc = complex<double>;

int main(void) {
    constexpr ll MOD = 1e9+7;
    constexpr double PI = acos(-1);
    cout << fixed << setprecision(32);
    cin.tie(0); ios::sync_with_stdio(false);

    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for(auto &e: a) cin >> e, e -= k;
    vector<ll> dp(30000);
    dp[15000] = 1;
    for(ll i=0; i<n; i++) {
        vector<ll> dq = dp;
        for(ll j=30000-1; j>=0; j--) {
            if(j-a[i]>=0) dp[j] += dq[j-a[i]];
        }
    }
    ll r = 0;
    for(ll i=15000; i<30000; i++)
        r += dp[i];
    cout << r-1 << endl;

}
0