結果

問題 No.1043 直列大学
ユーザー eQeeQe
提出日時 2020-05-01 22:13:17
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,158 bytes
コンパイル時間 1,630 ms
コンパイル使用メモリ 144,760 KB
実行使用メモリ 165,008 KB
最終ジャッジ日時 2023-08-26 14:20:23
合計ジャッジ時間 4,150 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
11,504 KB
testcase_01 AC 6 ms
9,008 KB
testcase_02 AC 9 ms
17,648 KB
testcase_03 AC 6 ms
9,196 KB
testcase_04 AC 6 ms
9,312 KB
testcase_05 AC 6 ms
9,100 KB
testcase_06 AC 6 ms
9,320 KB
testcase_07 AC 7 ms
13,620 KB
testcase_08 AC 7 ms
13,572 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 55 ms
147,072 KB
testcase_15 AC 61 ms
159,808 KB
testcase_16 AC 55 ms
142,600 KB
testcase_17 AC 41 ms
107,820 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 41 ms
103,752 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 30 ms
75,024 KB
testcase_28 WA -
testcase_29 AC 20 ms
46,328 KB
testcase_30 AC 40 ms
103,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <string>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) (a)=max(a, b)
#define chmin(a, b) (a)=min(a, b)
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;

/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/


ll dp[111][MAX];
ll ep[111][MAX];

int main(void) {
  ll i, j, k;
  
  ll N, M;
  ll v[111], r[111];
  ll A, B;
  
  cin >> N >> M;
  for(i=0; i<N; i++) cin >> v[i];
  for(i=0; i<M; i++) cin >> r[i];
  cin >> A >> B;
  
  dp[0][0]=1;
  for(i=0; i<N; i++) {
    for(j=0; j<MAX; j++) {
      dp[i+1][j]+=dp[i][j];
      if(j+v[i]<MAX) dp[i+1][j+v[i]]+=dp[i][j];
    }
  }
  
  ep[0][0]=1;
  for(i=0; i<M; i++) {
    for(j=0; j<MAX; j++) {
      ep[i+1][j]+=ep[i][j];
      if(j+r[i]<MAX) ep[i+1][j+r[i]]+=ep[i][j];
    }
  }
  
  ll s[MAX]={};
  for(i=1; i<MAX; i++) s[i]=s[i-1]+ep[M][i];
  
  ll ans=0;
  for(i=1; i<MAX; i++) {
    ll p=(i+B-1)/B;
    ll q=i/A;
    
    moC(ans, +, dp[N][i]*(s[q]-s[p-1])%MOD);
  }
  
  pt(ans);
  
}
 
 
0