結果
| 問題 |
No.1043 直列大学
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-01 21:36:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 622 bytes |
| コンパイル時間 | 648 ms |
| コンパイル使用メモリ | 65,816 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-24 23:03:30 |
| 合計ジャッジ時間 | 5,263 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 WA * 3 RE * 14 |
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
8 | main()
| ^~~~
ソースコード
#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;
}