結果
問題 | No.1238 選抜クラス |
ユーザー |
![]() |
提出日時 | 2020-10-06 11:52:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 470 bytes |
コンパイル時間 | 1,435 ms |
コンパイル使用メモリ | 165,972 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-20 00:44:13 |
合計ジャッジ時間 | 2,681 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; }