結果
問題 |
No.1238 選抜クラス
|
ユーザー |
![]() |
提出日時 | 2021-02-01 18:22:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 748 bytes |
コンパイル時間 | 683 ms |
コンパイル使用メモリ | 75,156 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-29 22:55:27 |
合計ジャッジ時間 | 1,887 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 WA * 8 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long ll; const ll mod = 1000000007; int main(){ int n , k; cin >> n >> k; vector<int> a(n); for(int i = 0; i < n; i++){ cin >> a[i]; a[i] -= k; } vector<ll> dp(22222 , 0); for(int i = 0; i < n; i++){ int j = a[i] + 10000; vector<ll> dp2 = dp; for(int k = 0; k <= 20000; k++){ if(k + a[i] > 0)dp2[k + a[i]] += dp[k]; } dp2[j] += 1; dp = dp2; } ll ans = 0; for(int i = 10000; i <= 20000; i++){ //cout << i << " : " << dp[i] << endl; ans += dp[i]; ans %= mod; } cout << ans << endl; return 0; }