結果

問題 No.1043 直列大学
ユーザー KY2001KY2001
提出日時 2020-05-01 22:38:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,822 bytes
コンパイル時間 2,061 ms
コンパイル使用メモリ 202,568 KB
実行使用メモリ 5,180 KB
最終ジャッジ日時 2023-08-26 15:22:33
合計ジャッジ時間 3,834 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
4,980 KB
testcase_01 AC 3 ms
4,576 KB
testcase_02 AC 4 ms
4,624 KB
testcase_03 AC 4 ms
5,016 KB
testcase_04 AC 3 ms
4,628 KB
testcase_05 AC 3 ms
4,572 KB
testcase_06 AC 3 ms
4,572 KB
testcase_07 AC 4 ms
4,644 KB
testcase_08 AC 4 ms
4,576 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 18 ms
4,636 KB
testcase_15 AC 19 ms
4,976 KB
testcase_16 AC 18 ms
4,576 KB
testcase_17 AC 13 ms
4,972 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
using ll      = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

int ceil_(int a, int b) { return (a + (b - 1)) / b; }
int bpm(int x, unsigned int y) {
  if (x == 0) return 0;
  if (y == 0) return 1;
  int ans   = 1;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  x %= MOD;
  for (unsigned int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) ans = ans * x % MOD;
    x = x * x % MOD;
  }
  return ans;
}
template <class T>
void cumulative_sum(T &container) {
  for (int i = 0; i < container.size() - 1; i++) container[i + 1] += container[i];
}

signed main() {
  int N, M;
  cin >> N >> M;
  vector<int> V(N);
  vector<int> R(M);
  rep(i, N) cin >> V[i];
  rep(i, M) cin >> R[i];
  int A, B;
  cin >> A >> B;
  vector<int> resist(100000 + 10000, 0);
  vector<int> electricity(100000 + 10000, 0);
  resist[0]      = 1;
  electricity[0] = 1;
  rep(i, N) {
    for (int j = 100000; j >= 0; j--) {
      if (j - R[i] >= 0) resist[j] += resist[j - R[i]];
    }
  }
  rep(i, M) {
    for (int j = 100000; j >= 0; j--) {
      if (j - V[i] >= 0) electricity[j] += electricity[j - V[i]];
    }
  }
  cumulative_sum(electricity);
  int ans = 0;
  rep(i, 100000) {
    ans = (ans + resist[i + 1] * (electricity[min(B * (i + 1), 100000LL)] - electricity[min(max(1LL, A * (i + 1)) - 1LL, 100000LL)])) % MOD;
  }
  cout << ans << endl;
}
0