結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 4 ms
5,992 KB
testcase_02 AC 5 ms
6,204 KB
testcase_03 AC 4 ms
5,948 KB
testcase_04 AC 4 ms
6,064 KB
testcase_05 AC 4 ms
5,952 KB
testcase_06 AC 4 ms
6,064 KB
testcase_07 AC 4 ms
6,108 KB
testcase_08 AC 5 ms
6,068 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 64 ms
36,800 KB
testcase_15 AC 74 ms
43,972 KB
testcase_16 AC 62 ms
36,652 KB
testcase_17 AC 40 ms
22,932 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 27 ms
16,772 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;
	dpR[m][0] = 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-1)/A;
		//cout<<i<<';'<<r<<' '<<l<<endl;
	(ans += ((sum[r+1]-sum[l])*dpV[n][i])%MOD)%=MOD;
		//cout<<ans<<endl;
	}
	cout<<ans<<endl;

}
0