Submission #888952

# Submission time Handle Problem Language Result Execution time Memory
888952 2023-12-18T13:04:22 Z dwuy Rice Hub (IOI11_ricehub) C++14
Compilation error
0 ms 0 KB
/// dwuy: _,\,,,_\,__,\,,_
#include <bits/stdc++.h>

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define file(a) freopen(a".inp","r",stdin); freopen(a".out", "w",stdout)
#define fi first
#define se second
#define endl "\n"
#define len(s) int32_t(s.length())
#define MASK(k)(1LL<<(k))
#define TASK ""

using namespace std;

typedef tuple<int, int, int> tpiii;
typedef pair<double, double> pdd;
typedef pair<int, int> pii;
typedef long long ll;

const long long OO = 1e18;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MX = 200005;

ll n, l, money;
ll a[MX];
ll sum[MX];

ll get(ll l, ll r){
    return sum[r] - sum[l-1];
}

ll cost(ll l, ll r){
    ll mid = (l+r)>>1;
    return get(mid+1, r) - get(l, mid - ((r-l+1)&1));
}

int besthub(ll N, ll L, ll X[], ll B){
    n = N;
    l = L;
    money = B;
    for(ll i=1; i<=n; i++){
        a[i] = X[i-1];
        sum[i] = sum[i-1] + a[i];
    }
    ll ans = 0;
    for(ll l=1, r=1; r<=n; r++){
        while(cost(l, r)>money) l++;
        ans = max(ans, r-l+1);
    }
    return ans;
}




Compilation message

/usr/bin/ld: /tmp/ccIceXKQ.o: in function `main':
grader.cpp:(.text.startup+0xae): undefined reference to `besthub(int, int, int*, long long)'
collect2: error: ld returned 1 exit status