結果
問題 | No.2694 The Early Bird Catches The Worm |
ユーザー | shkiiii_ |
提出日時 | 2024-03-22 22:05:32 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,665 bytes |
コンパイル時間 | 1,889 ms |
コンパイル使用メモリ | 171,100 KB |
実行使用メモリ | 15,872 KB |
最終ジャッジ日時 | 2024-09-30 11:36:00 |
合計ジャッジ時間 | 7,266 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,248 KB |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | AC | 2 ms
5,248 KB |
testcase_04 | AC | 2 ms
5,248 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 2 ms
5,248 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 2 ms
5,248 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
5,248 KB |
testcase_22 | AC | 2 ms
5,248 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | AC | 18 ms
6,144 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 37 ms
9,344 KB |
testcase_29 | AC | 12 ms
5,248 KB |
testcase_30 | WA | - |
testcase_31 | AC | 32 ms
8,576 KB |
testcase_32 | WA | - |
testcase_33 | AC | 58 ms
13,184 KB |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | AC | 11 ms
5,248 KB |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | AC | 65 ms
14,464 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 | 73 ms
15,744 KB |
testcase_55 | WA | - |
testcase_56 | AC | 73 ms
15,616 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 | 62 ms
15,744 KB |
testcase_70 | AC | 63 ms
15,744 KB |
testcase_71 | AC | 63 ms
15,744 KB |
testcase_72 | AC | 63 ms
15,744 KB |
testcase_73 | AC | 62 ms
15,744 KB |
testcase_74 | AC | 32 ms
9,472 KB |
testcase_75 | AC | 62 ms
15,744 KB |
ソースコード
#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),sb(n+1),ssb(n+1); 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){ int l = i,r = n+1; while(r-l > 1){ int mid = (l+r)/2; ll k = ssb[mid]-ssb[i] - sb[i]*(mid-i); if(k <= H)l = mid; else r = mid; } res = max<ll>(res,sa[l]-sa[i]); } cout << res << "\n"; return 0; }