結果
問題 | No.2694 The Early Bird Catches The Worm |
ユーザー | shkiiii_ |
提出日時 | 2024-03-22 22:21:33 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,679 bytes |
コンパイル時間 | 1,959 ms |
コンパイル使用メモリ | 172,192 KB |
実行使用メモリ | 15,892 KB |
最終ジャッジ日時 | 2024-09-30 11:52:53 |
合計ジャッジ時間 | 6,292 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 1 ms
6,816 KB |
testcase_02 | AC | 2 ms
6,816 KB |
testcase_03 | AC | 2 ms
6,816 KB |
testcase_04 | AC | 1 ms
6,820 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 1 ms
6,816 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 1 ms
6,816 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,820 KB |
testcase_22 | AC | 1 ms
6,816 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | AC | 16 ms
6,820 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 32 ms
9,344 KB |
testcase_29 | AC | 11 ms
6,816 KB |
testcase_30 | WA | - |
testcase_31 | AC | 28 ms
8,704 KB |
testcase_32 | WA | - |
testcase_33 | AC | 52 ms
13,184 KB |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | AC | 10 ms
6,816 KB |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | AC | 59 ms
14,412 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 | 66 ms
15,712 KB |
testcase_55 | WA | - |
testcase_56 | AC | 66 ms
15,716 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 | 55 ms
15,788 KB |
testcase_70 | AC | 55 ms
15,732 KB |
testcase_71 | AC | 56 ms
15,728 KB |
testcase_72 | AC | 56 ms
15,752 KB |
testcase_73 | AC | 56 ms
15,700 KB |
testcase_74 | AC | 28 ms
9,344 KB |
testcase_75 | AC | 56 ms
15,724 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,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; }