結果

問題 No.1043 直列大学
ユーザー kenken714kenken714
提出日時 2020-05-01 22:33:22
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,273 bytes
コンパイル時間 1,441 ms
コンパイル使用メモリ 91,992 KB
実行使用メモリ 19,952 KB
最終ジャッジ日時 2023-08-26 15:14:34
合計ジャッジ時間 12,658 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
19,388 KB
testcase_01 AC 32 ms
19,396 KB
testcase_02 AC 55 ms
19,400 KB
testcase_03 AC 32 ms
19,392 KB
testcase_04 AC 32 ms
19,396 KB
testcase_05 AC 32 ms
19,448 KB
testcase_06 AC 32 ms
19,424 KB
testcase_07 AC 43 ms
19,640 KB
testcase_08 AC 44 ms
19,392 KB
testcase_09 AC 288 ms
19,580 KB
testcase_10 WA -
testcase_11 AC 484 ms
19,424 KB
testcase_12 AC 544 ms
19,672 KB
testcase_13 WA -
testcase_14 AC 437 ms
19,424 KB
testcase_15 AC 536 ms
19,592 KB
testcase_16 AC 474 ms
19,416 KB
testcase_17 AC 312 ms
19,408 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 541 ms
19,412 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 161 ms
19,416 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>
#include <unordered_map>
#include <unordered_set>
#include <assert.h>
using namespace std;


#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (2 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>

ll dp[1100000], dp2[1100000], l, r;
int main() {
	ll n, m;
	cin >> n >> m;
	dp[0] = 1;
	dp2[0] = 1;
	vector<ll> a(n), b(m);
	REP(i, n)cin >> a[i];
	REP(i, m)cin >> b[i];
	cin >> l >> r;
	REP(i, n) REPR(j, 1000100) { dp[j + a[i]] += dp[j]; dp[j + a[i]] %= MOD; }
	REP(i, n) REPR(j, 1000100) { dp2[j + b[i]] += dp2[j]; dp2[j + b[i]] %= MOD; }
	REP(i, 1000100) {
		dp[i + 1] += dp[i];
		dp[i + 1] %= MOD;
	}
	ll ans = 0;
	REPO(i, 1000000) {
		ans += (dp[min(r * i, 1000050ll)] - dp[min(l * i - 1, 1000050ll)] + MOD) % MOD * dp2[i] % MOD;
		ans %= MOD;
	}
	cout << ans << endl;
}
0