結果

問題 No.1238 選抜クラス
ユーザー renjyaku_intrenjyaku_int
提出日時 2020-10-07 21:28:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,972 bytes
コンパイル時間 1,885 ms
コンパイル使用メモリ 202,688 KB
実行使用メモリ 27,156 KB
最終ジャッジ日時 2023-09-27 09:59:26
合計ジャッジ時間 7,007 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 RE -
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 RE -
testcase_06 AC 2 ms
4,380 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 6 ms
6,684 KB
testcase_10 AC 3 ms
5,180 KB
testcase_11 AC 6 ms
6,492 KB
testcase_12 AC 4 ms
5,936 KB
testcase_13 AC 4 ms
5,880 KB
testcase_14 RE -
testcase_15 AC 6 ms
6,684 KB
testcase_16 AC 5 ms
6,528 KB
testcase_17 AC 31 ms
27,156 KB
testcase_18 AC 30 ms
26,512 KB
testcase_19 RE -
testcase_20 AC 30 ms
26,016 KB
testcase_21 RE -
testcase_22 AC 32 ms
27,096 KB
testcase_23 RE -
testcase_24 AC 30 ms
27,068 KB
testcase_25 AC 31 ms
26,984 KB
testcase_26 AC 30 ms
27,096 KB
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 11 ms
10,716 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 AC 8 ms
7,896 KB
testcase_37 AC 11 ms
10,912 KB
testcase_38 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

//#include <tourist>
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//g++ yarudake.cpp -std=c++17 -I .
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    rep(i, n)
    {
        a[i] -= k;
    }
    vector<vector<ll>> dp(n + 1, vector<ll>(30000 + 1, 0));
    dp[0][10000] = 1;
    rep(i, n)
    {
        rep(j, 30000 + 1)
        {
            dp[i + 1][j] += dp[i][j];
            dp[i + 1][j] %= MOD;
            dp[i + 1][j + a[i]] += dp[i][j];
            dp[i + 1][j + a[i]] %= MOD;
        }
    }
    ll ans = 0;
    for(int i=10000;i<=30000;i++)
    {
        ans += dp[n][i];
        ans %= MOD;
    }
    cout << ans-1 << "\n";
}
0