結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
4,524 KB
testcase_01 AC 4 ms
4,456 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 4 ms
4,408 KB
testcase_06 AC 5 ms
4,396 KB
testcase_07 AC 5 ms
4,540 KB
testcase_08 AC 5 ms
4,540 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 46 ms
4,516 KB
testcase_15 AC 51 ms
4,524 KB
testcase_16 AC 46 ms
4,516 KB
testcase_17 AC 34 ms
4,404 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 25 ms
4,532 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} ;
// } fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	constexpr int MAX = 1010 * 100;
	
	int N, M;
	int A, B;
	int ans = 0;
	vector<int> V, R;
	vector<int> Vtable(MAX);
	vector<int> Rtable(MAX);
	
	cin>>N>>M;
	
	V.resize(N);
	R.resize(M);
	
	
	for(int i = 0; i < N; i++){
		cin>>V[i];
	}
	
	for(int i = 0; i < M; i++){
		cin>>R[i];
	}
	
	cin>>A>>B;
	
	Vtable[0] = 1;
	Rtable[0] = 1;
	
	for(int i = 0; i < N; i++){
		for(int j = MAX - V[i] - 1; j >= 0; j--){
			Vtable[j+V[i]] += Vtable[j];
			Vtable[j+V[i]] %= MOD;
		}
	}
	
	for(int i = 0; i < M; i++){
		for(int j = MAX - R[i] - 1; j >= 0; j--){
			Rtable[j+R[i]] += Rtable[j];
			Rtable[j+R[i]] %= MOD;
		}
	}
	
	for(int i = 1; i < MAX; i++){
		Vtable[i] += Vtable[i-1];
		Vtable[i] %= MOD;
	}
	
	for(int i = 1; i < MAX; i++){
		int a = A * i;
		int b = B * i;
		
		a = min(MAX-2, a);
		b = min(MAX-2, b);
		
		ans += (Vtable[b+1] + MOD - Vtable[a]) % MOD  * Rtable[i] % MOD;
		ans %= MOD;
	}
	
	cout<<ans<<endl;
	
	return 0;
}
0