結果

問題 No.1043 直列大学
ユーザー chocoruskchocorusk
提出日時 2020-05-01 21:43:04
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 1,188 bytes
コンパイル時間 1,525 ms
コンパイル使用メモリ 126,260 KB
実行使用メモリ 5,144 KB
最終ジャッジ日時 2023-08-24 05:40:25
合計ジャッジ時間 3,026 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
4,820 KB
testcase_01 AC 4 ms
4,952 KB
testcase_02 AC 5 ms
4,960 KB
testcase_03 AC 4 ms
4,968 KB
testcase_04 AC 4 ms
4,904 KB
testcase_05 AC 4 ms
4,844 KB
testcase_06 AC 4 ms
4,848 KB
testcase_07 AC 5 ms
4,824 KB
testcase_08 AC 5 ms
4,880 KB
testcase_09 AC 20 ms
4,812 KB
testcase_10 AC 22 ms
4,980 KB
testcase_11 AC 32 ms
4,836 KB
testcase_12 AC 35 ms
4,912 KB
testcase_13 AC 29 ms
4,868 KB
testcase_14 AC 31 ms
4,824 KB
testcase_15 AC 33 ms
4,900 KB
testcase_16 AC 30 ms
4,872 KB
testcase_17 AC 23 ms
4,816 KB
testcase_18 AC 23 ms
4,872 KB
testcase_19 AC 29 ms
5,144 KB
testcase_20 AC 22 ms
4,900 KB
testcase_21 AC 27 ms
4,840 KB
testcase_22 AC 28 ms
4,820 KB
testcase_23 AC 34 ms
4,820 KB
testcase_24 AC 25 ms
4,844 KB
testcase_25 AC 29 ms
4,916 KB
testcase_26 AC 30 ms
4,808 KB
testcase_27 AC 16 ms
4,804 KB
testcase_28 AC 28 ms
4,916 KB
testcase_29 AC 11 ms
4,864 KB
testcase_30 AC 23 ms
4,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n, m;
	cin>>n>>m;
	int v[101], r[101];
	for(int i=0; i<n; i++) cin>>v[i];
	for(int i=0; i<m; i++) cin>>r[i];
	ll dpv[100002]={}, dpr[100002]={};
	dpv[0]=1, dpr[0]=1;
	const int mx=100000;
	const ll MOD=1e9+7;
	for(int i=0; i<n; i++){
		for(int j=mx-v[i]; j>=0; j--){
			(dpv[j+v[i]]+=dpv[j])%=MOD;
		}
	}
	for(int i=0; i<m; i++){
		for(int j=mx-r[i]; j>=0; j--){
			(dpr[j+r[i]]+=dpr[j])%=MOD;
		}
	}
	for(int i=1; i<=mx; i++){
		(dpv[i]+=dpv[i-1])%=MOD;
	}
	ll a, b; cin>>a>>b;
	ll ans=0;
	for(int i=1; i<=mx/a; i++){
		ll l=a*i, r=min((ll)mx, b*i);
		(ans+=dpr[i]*(dpv[r]-dpv[l-1]+MOD))%=MOD;
	}
	cout<<ans<<endl;
	return 0;
}
0