結果

問題 No.1043 直列大学
ユーザー kotatsugamekotatsugame
提出日時 2020-05-01 21:36:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 622 bytes
コンパイル時間 479 ms
コンパイル使用メモリ 65,936 KB
実行使用メモリ 6,112 KB
最終ジャッジ日時 2023-08-26 07:18:34
合計ジャッジ時間 3,919 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,340 KB
testcase_01 AC 2 ms
5,360 KB
testcase_02 AC 2 ms
5,344 KB
testcase_03 AC 2 ms
5,468 KB
testcase_04 AC 1 ms
5,452 KB
testcase_05 AC 2 ms
5,360 KB
testcase_06 AC 1 ms
5,536 KB
testcase_07 AC 2 ms
5,544 KB
testcase_08 WA -
testcase_09 AC 1 ms
5,644 KB
testcase_10 AC 2 ms
5,596 KB
testcase_11 RE -
testcase_12 AC 16 ms
6,112 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 WA -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 WA -
testcase_28 AC 5 ms
5,416 KB
testcase_29 AC 2 ms
5,348 KB
testcase_30 AC 6 ms
5,632 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;
		ans+=(dv[R]+mod-dv[L-1])*dr[i]%mod;
	}
	cout<<(ans%mod+mod)%mod<<endl;
}
0