結果
問題 |
No.1238 選抜クラス
|
ユーザー |
👑 ![]() |
提出日時 | 2020-09-28 11:08:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 536 bytes |
コンパイル時間 | 1,565 ms |
コンパイル使用メモリ | 166,804 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-01 19:43:43 |
合計ジャッジ時間 | 2,867 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 9 |
ソースコード
#include<bits/stdc++.h> using namespace std; using LL = long long; using ULL = unsigned long long; #define rep(i,n) for(int i=0; i<(n); i++) const ULL M=1000000007; const int Z=20001; ULL dp[Z] = {}; ULL dpb[Z] = {}; int main() { int N,K; scanf("%d%d",&N,&K); int A[100]; rep(i,N){ scanf("%d",&A[i]); A[i]-=K; } dp[Z/2]=1; rep(i,N){ rep(i,Z) dpb[i]=dp[i]; for(int j=100; j<Z-100; j++) dp[j+A[i]] += dpb[j]; if((N-i)%16==1) dp[i]%=M; } ULL ans=0; rep(i,Z/2) ans+=dp[Z/2+i]; ans %= M; cout<<(ans-1)<<endl; return 0; }