結果

問題 No.2694 The Early Bird Catches The Worm
ユーザー shkiiii_shkiiii_
提出日時 2024-03-22 22:21:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,679 bytes
コンパイル時間 1,747 ms
コンパイル使用メモリ 171,632 KB
実行使用メモリ 15,868 KB
最終ジャッジ日時 2024-03-22 22:21:42
合計ジャッジ時間 7,686 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
6,676 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
6,676 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
6,676 KB
testcase_22 AC 2 ms
6,676 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 20 ms
6,676 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 39 ms
9,472 KB
testcase_29 AC 14 ms
6,676 KB
testcase_30 WA -
testcase_31 AC 35 ms
8,832 KB
testcase_32 WA -
testcase_33 AC 62 ms
13,196 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 11 ms
6,676 KB
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 69 ms
14,556 KB
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 AC 77 ms
15,868 KB
testcase_55 WA -
testcase_56 AC 76 ms
15,868 KB
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 WA -
testcase_68 WA -
testcase_69 AC 65 ms
15,868 KB
testcase_70 AC 66 ms
15,868 KB
testcase_71 AC 66 ms
15,868 KB
testcase_72 AC 65 ms
15,868 KB
testcase_73 AC 67 ms
15,868 KB
testcase_74 AC 34 ms
9,600 KB
testcase_75 AC 67 ms
15,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
// #include<atcoder/all>
// #include<boost/multiprecision/cpp_int.hpp>

using namespace std;
// using namespace atcoder;
// using bint = boost::multiprecision::cpp_int;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using vi = vector<ll>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define sz(c) ((ll)(c).size())
#define LB(A,x) (int)(lower_bound(A.begin(),A.end(),x)-A.begin())
// #define MOD 1000000007
#define MOD 998244353
template<typename T>using min_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<typename T>ostream&operator<<(ostream&os,vector<T>&v){for(int i = 0;i < v.size();i++)os<<v[i]<<(i+1!=v.size()?" ":"");return os;}
template<typename T>istream&operator>>(istream&is,vector<T>&v){for(T&in:v)is>>in;return is;}
template<typename T1,typename T2>ostream&operator<<(ostream&os,pair<T1,T2>&p){os<<p.first<<" "<<p.second;return os;}
template<typename T1,typename T2>istream&operator>>(istream&is,pair<T1,T2>&p){is>>p.first>>p.second;return is;}



int main(){
  
  ios_base::sync_with_stdio(0), cin.tie(0);
  ll n,H;
  cin >> n >> H;
  vi a(n),b(n);
  cin >> a >> b;
  vector<__int128_t> sa(n+1,0),sb(n+1,0),ssb(n+1,0);
  rep(i,n)sa[i+1] = sa[i] + a[i];
  rep(i,n)sb[i+1] = sb[i] + b[i];
  rep(i,n)ssb[i+1] = ssb[i] + sb[i+1];
  ll res = 0;
  rep(i,n){
    ll l = 0,r = n-i+1;
    while(r-l > 1){
      ll mid = (l+r)/2;
      __int128_t k = ssb[i+mid]-ssb[i] - sb[i]*mid;
      if(k <= H)l = mid;
      else r = mid;
    }
    res = max<ll>(res,sa[i+l]-sa[i]);
  }
  cout << res << "\n";
  

  return 0;
}
0