結果

問題 No.1043 直列大学
ユーザー yutasyutas
提出日時 2020-05-01 22:36:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,026 bytes
コンパイル時間 816 ms
コンパイル使用メモリ 94,360 KB
実行使用メモリ 166,968 KB
最終ジャッジ日時 2023-08-26 15:18:16
合計ジャッジ時間 2,978 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
11,132 KB
testcase_01 AC 3 ms
11,124 KB
testcase_02 AC 5 ms
15,416 KB
testcase_03 AC 3 ms
11,140 KB
testcase_04 AC 3 ms
11,188 KB
testcase_05 AC 4 ms
11,120 KB
testcase_06 AC 3 ms
11,124 KB
testcase_07 AC 4 ms
11,204 KB
testcase_08 AC 4 ms
11,120 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 51 ms
139,260 KB
testcase_15 AC 56 ms
144,204 KB
testcase_16 AC 51 ms
137,896 KB
testcase_17 AC 37 ms
105,392 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 36 ms
103,288 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 27 ms
74,656 KB
testcase_28 WA -
testcase_29 AC 17 ms
48,036 KB
testcase_30 AC 35 ms
103,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1ll << 60;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, M, V[105], R[105]; ll A, B;
ll DPV[105][100005], DPR[105][100005];
ll SumV[int(1e5 + 5)], SumR[int(1e5 + 5)];

int main(){
  scanf("%d%d", &N, &M);
  for (int i = 1; i <= N; i++) scanf("%d", V + i);
  for (int i = 1; i <= M; i++) scanf("%d", R + i);
  scanf("%lld%lld", &A, &B);

  DPV[0][0] = 1;
  for (int i = 1; i <= N; i++){
    for (int j = 0; j <= 1e5; j++){
      if (DPV[i - 1][j] == 0) continue;
      DPV[i][j] += DPV[i - 1][j];
      if (j + V[i] <= 1e5) DPV[i][j + V[i]] += DPV[i - 1][j];
    }
  }

  DPR[0][0] = 1;
  for (int i = 1; i <= M; i++){
    for (int j = 0; j <= 1e5; j++){
      if (DPR[i - 1][j] == 0) continue;
      DPR[i][j] += DPR[i - 1][j];
      if (j + R[i] <= 1e5) DPR[i][j + R[i]] += DPR[i - 1][j];
    }
  }
  
  for (int i = 1; i <= 1e5; i++){
    SumV[i] = SumV[i - 1] + DPV[N][i];
    SumR[i] = SumR[i - 1] + DPR[M][i];
  }
  
  ll ans = 0;
  for (ll i = 1; i <= 1e5; i++){
    if (SumR[i] == SumR[i - 1]) continue;
    ll now = SumR[i] - SumR[i - 1];

    ll nowA = A * i, nowB = B * i;
    if (nowA > 1e5) break;

    nowA--;
    if (nowB > 1e5) nowB = 1e5;
    ans += now * (SumV[nowB] - SumV[nowA]);
    ans %= MOD;
  }
  cout << ans << endl;

  return 0;
}
0