結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,020 KB
testcase_01 AC 4 ms
6,004 KB
testcase_02 AC 5 ms
5,940 KB
testcase_03 AC 4 ms
5,996 KB
testcase_04 AC 4 ms
6,008 KB
testcase_05 AC 4 ms
5,988 KB
testcase_06 AC 4 ms
6,072 KB
testcase_07 AC 5 ms
6,012 KB
testcase_08 AC 5 ms
6,196 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 68 ms
36,792 KB
testcase_15 AC 78 ms
43,688 KB
testcase_16 AC 67 ms
36,564 KB
testcase_17 AC 43 ms
22,924 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,672 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];
		//cout<<ans<<endl;
	}
	cout<<ans<<endl;

}
0