結果

問題 No.2694 The Early Bird Catches The Worm
ユーザー yansi819yansi819
提出日時 2024-04-03 09:36:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 803 bytes
コンパイル時間 4,511 ms
コンパイル使用メモリ 262,656 KB
実行使用メモリ 16,276 KB
最終ジャッジ日時 2024-04-03 09:36:37
合計ジャッジ時間 14,377 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
13,480 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 1 ms
6,548 KB
testcase_04 AC 2 ms
6,548 KB
testcase_05 AC 2 ms
6,548 KB
testcase_06 AC 3 ms
6,548 KB
testcase_07 AC 2 ms
6,548 KB
testcase_08 AC 2 ms
6,548 KB
testcase_09 AC 2 ms
6,548 KB
testcase_10 AC 2 ms
6,548 KB
testcase_11 AC 2 ms
6,548 KB
testcase_12 AC 2 ms
6,548 KB
testcase_13 AC 2 ms
6,548 KB
testcase_14 AC 2 ms
6,548 KB
testcase_15 AC 2 ms
6,548 KB
testcase_16 AC 2 ms
6,548 KB
testcase_17 AC 2 ms
6,548 KB
testcase_18 AC 2 ms
6,548 KB
testcase_19 AC 2 ms
6,548 KB
testcase_20 AC 2 ms
6,548 KB
testcase_21 AC 2 ms
6,548 KB
testcase_22 AC 2 ms
6,548 KB
testcase_23 AC 2 ms
6,548 KB
testcase_24 AC 45 ms
6,548 KB
testcase_25 AC 40 ms
6,548 KB
testcase_26 AC 52 ms
6,548 KB
testcase_27 AC 71 ms
6,548 KB
testcase_28 AC 83 ms
6,548 KB
testcase_29 AC 27 ms
6,548 KB
testcase_30 AC 127 ms
8,192 KB
testcase_31 AC 73 ms
6,548 KB
testcase_32 AC 134 ms
8,448 KB
testcase_33 AC 132 ms
8,320 KB
testcase_34 AC 7 ms
6,548 KB
testcase_35 AC 66 ms
6,548 KB
testcase_36 AC 85 ms
6,548 KB
testcase_37 AC 146 ms
8,960 KB
testcase_38 AC 96 ms
7,040 KB
testcase_39 AC 23 ms
6,548 KB
testcase_40 AC 72 ms
6,548 KB
testcase_41 AC 34 ms
6,548 KB
testcase_42 AC 5 ms
6,548 KB
testcase_43 AC 13 ms
6,548 KB
testcase_44 AC 145 ms
8,960 KB
testcase_45 AC 147 ms
8,960 KB
testcase_46 AC 44 ms
6,548 KB
testcase_47 AC 47 ms
6,548 KB
testcase_48 AC 81 ms
6,548 KB
testcase_49 TLE -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
testcase_64 -- -
testcase_65 -- -
testcase_66 -- -
testcase_67 -- -
testcase_68 -- -
testcase_69 -- -
testcase_70 -- -
testcase_71 -- -
testcase_72 -- -
testcase_73 -- -
testcase_74 -- -
testcase_75 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;
using mint = modint998244353;

int main() {
  ll N, H; cin >> N >> H;
  vector<ll> A(N), B(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < N; i++) cin >> B[i];
  vector<ll> sumA(N + 1), sumB(N + 1);
  for (int i = 0; i < N; i++) {
    sumA[i + 1] = sumA[i] + A[i];
    sumB[i + 1] = sumB[i] + B[i];
  }
  int L = 0, R = 0;
  ll ans = 0;
  while (true) {
    if (R >= N) break;
    ll BB = 0;
    for (int i = 1; i <= R - L + 1; i++) {
      BB += sumB[R + 1] - sumB[L + i - 1];
    }
    if (BB <= H) {
      ans = max(ans, sumA[R + 1] - sumA[L]);
      R++;
    } else {
      L++;
      R = L;
    }
  }
  cout << ans << endl;
  return 0;
}
0