結果

問題 No.1043 直列大学
ユーザー 夜
提出日時 2021-01-24 18:56:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 994 bytes
コンパイル時間 1,015 ms
コンパイル使用メモリ 91,224 KB
実行使用メモリ 5,132 KB
最終ジャッジ日時 2023-08-24 12:54:48
合計ジャッジ時間 2,841 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
4,920 KB
testcase_01 AC 5 ms
4,932 KB
testcase_02 AC 6 ms
4,876 KB
testcase_03 AC 5 ms
4,880 KB
testcase_04 AC 5 ms
4,912 KB
testcase_05 AC 5 ms
4,880 KB
testcase_06 AC 4 ms
4,852 KB
testcase_07 AC 5 ms
4,948 KB
testcase_08 AC 5 ms
4,916 KB
testcase_09 AC 20 ms
4,936 KB
testcase_10 AC 24 ms
4,880 KB
testcase_11 AC 33 ms
4,928 KB
testcase_12 AC 36 ms
4,880 KB
testcase_13 AC 31 ms
4,852 KB
testcase_14 AC 32 ms
5,016 KB
testcase_15 AC 35 ms
4,876 KB
testcase_16 AC 32 ms
4,864 KB
testcase_17 AC 24 ms
4,960 KB
testcase_18 AC 24 ms
5,124 KB
testcase_19 AC 30 ms
4,944 KB
testcase_20 AC 24 ms
5,132 KB
testcase_21 AC 28 ms
4,880 KB
testcase_22 AC 29 ms
4,948 KB
testcase_23 AC 36 ms
4,880 KB
testcase_24 AC 26 ms
4,896 KB
testcase_25 AC 31 ms
4,912 KB
testcase_26 AC 32 ms
5,028 KB
testcase_27 AC 18 ms
4,960 KB
testcase_28 AC 30 ms
4,876 KB
testcase_29 AC 13 ms
5,128 KB
testcase_30 AC 23 ms
4,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long long v[110000] = {}, r[110000] = {};
long long const mod = 1000000007;
long long const mx = 100010;
int main() {
	long long n, m, a, b;
	cin >> n >> m;
	v[0] = 1, r[0] = 1;
	for (int i = 0; i < n; i++) {
		int vi;
		cin >> vi;
		for (int j = mx; j >= vi; j--) {
			v[j] += v[j - vi];
			v[j] %= mod;
		}
	}
	for (int i = 0; i < m; i++) {
		int ri;
		cin >> ri;
		for (int j = mx; j >= ri; j--) {
			r[j] += r[j - ri];
			r[j] %= mod;
		}
	}
	cin >> a >> b;
	long long ans = 0;
	for (int i = 1; i <= mx; i++) {
		v[i] += v[i - 1];
		v[i] %= mod;
	}
	for (int i = 1; i < mx; i++) {
		ans += r[i] * (v[min(i * b, mx)] - v[min(i * a - 1, mx)]) % mod;
		ans %= mod;
	}
	cout << (ans + mod) % mod << endl;
}
0