結果
問題 |
No.1238 選抜クラス
|
ユーザー |
👑 ![]() |
提出日時 | 2020-09-28 11:04:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 10 ms / 2,000 ms |
コード長 | 470 bytes |
コンパイル時間 | 1,503 ms |
コンパイル使用メモリ | 166,188 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-01 19:37:38 |
合計ジャッジ時間 | 3,096 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 36 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ULL = unsigned long long; #define rep(i,n) for(int i=0; i<(n); i++) const ULL M=1000000007; const int Z=40001; ULL dp[Z] = {}; ULL dpb[Z] = {}; int main() { int N,K; cin>>N>>K; int A[100]; rep(i,N){ cin>>A[i]; A[i]-=K; } dp[Z/2]=1; rep(i,N){ rep(i,Z) dpb[i]=dp[i]%M; for(int j=100; j<Z-100; j++) dp[j+A[i]] += dpb[j]; } ULL ans=0; rep(i,Z/2) ans+=dp[Z/2+i]; ans %= M; cout<<(ans-1)<<endl; return 0; }