結果

問題 No.1043 直列大学
ユーザー ttkkggwwttkkggww
提出日時 2020-05-01 22:42:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 988 bytes
コンパイル時間 1,398 ms
コンパイル使用メモリ 168,276 KB
実行使用メモリ 74,964 KB
最終ジャッジ日時 2023-08-26 15:26:55
合計ジャッジ時間 3,706 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
5,976 KB
testcase_01 AC 4 ms
6,208 KB
testcase_02 AC 4 ms
5,988 KB
testcase_03 AC 3 ms
5,932 KB
testcase_04 AC 3 ms
5,956 KB
testcase_05 AC 3 ms
5,956 KB
testcase_06 AC 3 ms
5,932 KB
testcase_07 AC 4 ms
5,888 KB
testcase_08 AC 4 ms
5,908 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 65 ms
36,884 KB
testcase_15 AC 77 ms
43,604 KB
testcase_16 AC 65 ms
36,560 KB
testcase_17 AC 41 ms
23,024 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 29 ms
16,628 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
ll dpV[101][100001],dpR[101][100001];

int main()
{
	int n,m;
	cin >> n >> m;
	vector<int> V(n),R(m);
	for(int i = 0;i<n;i++)cin >> V[i];
	for(int i = 0;i<m;i++)cin >> R[i];
	int A,B;
	cin >> A >> B;
	dpV[0][0]=dpR[0][0]=1;
	for(int i = 0;i<n;i++)
	{
		for(int j = 0;j<100001;j++)
		{
			if(dpV[i][j])
			{
				(dpV[i+1][j]+=dpV[i][j])%=MOD;
				(dpV[i+1][j+V[i]]+=dpV[i][j])%=MOD;
			}
		}
	}
	for(int i =0;i<m;i++)
	{
		for(int j = 0;j<100001;j++)
		{
			if(dpR[i][j])
			{
				(dpR[i+1][j]+=dpR[i][j])%=MOD;
				(dpR[i+1][j+R[i]]+=dpR[i][j])%=MOD;
			}
		}
	}
	ll ans = 0;
	vector<ll> sum(100002);
	for(int i = 0;i<100001;i++)
	{
		(sum[i+1] += sum[i]+dpR[m][i])%=MOD;
		//cout<<sum[i+1]<<endl;
	}
	
	for(int i = 1;i<16;i++)
	{
		int r,l;
		l = (i+B-1)/B;
		r = i/A;
		//cout<<i<<';'<<r<<' '<<l<<endl;
	(ans += ((sum[r+1]-sum[l])*dpV[n][i])%MOD)%=MOD;
		//cout<<ans<<endl;
	}
	cout<<ans<<endl;

}
0