제출 #500804

#제출 시각아이디문제언어결과실행 시간메모리
500804beaconmc쌀 창고 (IOI11_ricehub)C++14
0 / 100
57 ms1180 KiB
//#include "ricehub.h"
#include <bits/stdc++.h>


typedef long long ll;
#define FOR(i, x, y) for(ll i=x; i<y; i++)

using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
  
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>


int besthub(int R, int L, int X[], ll B){
    ll lo = 0, hi = 0;
    ll ans = 0;
    ll curcost  = 0;
    while (hi<R-1){
        if ((hi-lo+1)%2==0) curcost += X[hi+1] - X[(hi-lo)/2+1 + lo];
        else curcost += X[hi+1] - X[(hi-lo)/2 + lo];
        if (curcost>B){
            if ((hi-lo+1)%2==0) curcost -= X[hi+1], curcost += X[lo];
            else curcost -= X[hi+1], curcost+= X[lo];
            lo ++;
        } else hi++;
        cout << "LOL" << lo << " " << hi << " " << curcost << endl;
        ans = max(ans, hi-lo+1);
    }
    return ans;
}


/*int main(){
    int R,L,B;
    cin >> R >> L >> B;
    int X[R];
    FOR(i, 0, R){
        cin >> X[i];
    }
    cout << besthub(R, L, X, B);
}*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...