제출 #1185027

#제출 시각아이디문제언어결과실행 시간메모리
1185027al95ireyiz쌀 창고 (IOI11_ricehub)C++20
100 / 100
8 ms1352 KiB
//*** Bismillah ***// #pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #if !defined(ONLINE_JUDGE) and !defined(EVAL) #include "template/debug.h" #else #define d(x...) #endif #define fr first #define sc second #define in insert #define ll long long #define pb push_back #define vll vector<ll> #define pll pair<ll,ll> #define all(x)x.begin(),x.end() const ll INF = 1e9; const ll INFL = 1e18; const ll MOD = 1e9+7; // const ll MOD = 998244353; const ll maxn = 1e5+5; ll n,m,k=0; #include "ricehub.h" ll a[maxn]; int besthub(int _R, int _L, int _X[], ll _B){ n = _R, m = _L, k = _B; for(ll i=0;i<maxn;i++) a[i] = INFL; for(ll i=1;i<=n;i++) a[i] = _X[i-1]; ll l=1, r=0, cv=0, cm=0, lsay=0, rsay=0, mdn=0, ind=0; while(l<=n){ if(cm + (lsay-rsay) * a[mdn] <= k){ cv = max(cv, r-l+1); if(r == n) break; cm += a[++r]; } else{ cm += a[l++]; } lsay = (r-l)/2+1; rsay = (r-l+1)-lsay; mdn = l+lsay-1; while(ind < mdn){ ind ++; cm -= 2*a[ind]; } } return cv; } // void _(){ // ll x, b, c; // cin>>x>>b>>c; // int d[x]; // for(ll i=0;i<x;i++) cin>>d[i]; // cout<<besthub(x, b, d, c)<<'\n'; // } // signed main(){ // ll tm=clock(); // cin.tie(0)->sync_with_stdio(0); // ll t=1; // // cin>>t; // while(t--) _(); // cerr<<"\n\033[1;31mTime: \033[1;30m" // <<(double)(clock()-tm)/1000000<<"\033[1;32m seconds\n"; // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...