結果

問題 No.1043 直列大学
ユーザー kotatsugamekotatsugame
提出日時 2020-05-01 21:37:00
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 638 bytes
コンパイル時間 507 ms
コンパイル使用メモリ 66,544 KB
実行使用メモリ 6,160 KB
最終ジャッジ日時 2023-08-24 05:39:29
合計ジャッジ時間 1,993 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,480 KB
testcase_01 AC 2 ms
5,404 KB
testcase_02 AC 2 ms
5,480 KB
testcase_03 AC 2 ms
5,404 KB
testcase_04 AC 2 ms
5,440 KB
testcase_05 AC 2 ms
5,456 KB
testcase_06 AC 2 ms
5,404 KB
testcase_07 AC 2 ms
5,444 KB
testcase_08 AC 2 ms
5,480 KB
testcase_09 AC 2 ms
5,500 KB
testcase_10 AC 3 ms
5,636 KB
testcase_11 AC 6 ms
5,680 KB
testcase_12 AC 19 ms
6,160 KB
testcase_13 AC 8 ms
5,676 KB
testcase_14 AC 9 ms
5,844 KB
testcase_15 AC 10 ms
5,848 KB
testcase_16 AC 9 ms
5,824 KB
testcase_17 AC 6 ms
5,724 KB
testcase_18 AC 5 ms
5,572 KB
testcase_19 AC 8 ms
5,680 KB
testcase_20 AC 6 ms
5,788 KB
testcase_21 AC 7 ms
5,636 KB
testcase_22 AC 8 ms
5,664 KB
testcase_23 AC 11 ms
5,968 KB
testcase_24 AC 6 ms
5,812 KB
testcase_25 AC 8 ms
5,728 KB
testcase_26 AC 9 ms
5,680 KB
testcase_27 AC 4 ms
5,752 KB
testcase_28 AC 6 ms
5,404 KB
testcase_29 AC 3 ms
5,396 KB
testcase_30 AC 8 ms
5,404 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    8 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
const long mod=1e9+7;
long dv[2<<17],dr[2<<17];
int N,M;
int V[100],R[100];
long A,B;
main()
{
	cin>>N>>M;
	int sv=0,sr=0;
	dv[0]=1;
	for(int i=0;i<N;i++)
	{
		cin>>V[i];
		for(int j=sv;j>=0;j--)
		{
			(dv[j+V[i]]+=dv[j])%=mod;
		}
		sv+=V[i];
	}
	dr[0]=1;
	for(int i=0;i<M;i++)
	{
		cin>>R[i];
		for(int j=sr;j>=0;j--)
		{
			(dr[j+R[i]]+=dr[j])%=mod;
		}
		sr+=R[i];
	}
	cin>>A>>B;
	for(int i=1;i<=sv;i++)(dv[i]+=dv[i-1])%=mod;
	long ans=0;
	for(int i=1;i<=sr;i++)
	{
		long L=A*i,R=B*i;
		if(R>sv)R=sv;
		if(R<L)break;
		ans+=(dv[R]+mod-dv[L-1])*dr[i]%mod;
	}
	cout<<(ans%mod+mod)%mod<<endl;
}
0