結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,064 KB
testcase_01 AC 3 ms
5,968 KB
testcase_02 AC 4 ms
5,820 KB
testcase_03 AC 4 ms
5,980 KB
testcase_04 AC 3 ms
5,936 KB
testcase_05 AC 3 ms
6,016 KB
testcase_06 AC 3 ms
6,112 KB
testcase_07 AC 3 ms
5,892 KB
testcase_08 AC 4 ms
5,892 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 59 ms
36,948 KB
testcase_15 AC 70 ms
43,724 KB
testcase_16 AC 59 ms
36,624 KB
testcase_17 AC 36 ms
22,844 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 26 ms
16,596 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()
{
	ll n,m;
	cin >> n >> m;
	vector<ll> V(n),R(m);
	for(ll i = 0;i<n;i++)cin >> V[i];
	for(ll i = 0;i<m;i++)cin >> R[i];
	ll A,B;
	cin >> A >> B;
	dpV[0][0]=dpR[0][0]=1;
	for(ll i = 0;i<n;i++)
	{
		for(ll 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(ll i =0;i<m;i++)
	{
		for(ll 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(ll i = 0;i<100001;i++)
	{
		(sum[i+1] += sum[i]+dpR[m][i])%=MOD;
		//cout<<sum[i+1]<<endl;
	}
	
	for(ll i = 1;i<16;i++)
	{
		ll 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