結果

問題 No.1238 選抜クラス
ユーザー okok
提出日時 2020-09-25 22:52:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 512 ms / 2,000 ms
コード長 1,046 bytes
コンパイル時間 892 ms
コンパイル使用メモリ 88,160 KB
実行使用メモリ 11,748 KB
最終ジャッジ日時 2023-09-10 16:03:35
合計ジャッジ時間 9,666 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 3 ms
4,376 KB
testcase_17 AC 507 ms
11,548 KB
testcase_18 AC 464 ms
11,008 KB
testcase_19 AC 478 ms
11,312 KB
testcase_20 AC 438 ms
10,704 KB
testcase_21 AC 392 ms
10,212 KB
testcase_22 AC 511 ms
11,540 KB
testcase_23 AC 510 ms
11,452 KB
testcase_24 AC 507 ms
11,500 KB
testcase_25 AC 505 ms
11,540 KB
testcase_26 AC 512 ms
11,748 KB
testcase_27 AC 505 ms
11,536 KB
testcase_28 AC 506 ms
11,436 KB
testcase_29 AC 477 ms
11,272 KB
testcase_30 AC 16 ms
4,380 KB
testcase_31 AC 88 ms
5,760 KB
testcase_32 AC 231 ms
8,112 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 310 ms
9,064 KB
testcase_35 AC 31 ms
4,572 KB
testcase_36 AC 5 ms
4,380 KB
testcase_37 AC 19 ms
4,376 KB
testcase_38 AC 435 ms
10,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	int MAX = 101;
	int N, K;
	vector<int> A;
	vector<vector<int>> dp;
	int ans = 0;
	
	cin>>N>>K;
	
	A.resize(N);
	dp.resize(MAX * N, vector<int>(N+2));
	
	for(int i = 0; i < N; i++){
		cin>>A[i];
	}
	
	dp[0][0] = 1;
	
	for(int i = 0; i < N; i++){
		for(int j = MAX * N - 1; j >= 0; j--){
			for(int k = N; k >= 0; k--){
				
				if(j + A[i] < MAX * N) {
					dp[j + A[i]][k + 1] += dp[j][k];
					dp[j + A[i]][k + 1] %= MOD;
				}
			}
		}
	}
	for(int j = MAX * N - 1; j >= 0; j--){
		for(int k = N; k >= 1; k--){
			
			if(j >= k * K) {
				ans += dp[j][k];
				ans %= MOD;
			}
		}
	}
	
	cout<<ans<<endl;
	
	return 0;
}
0