# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
888950 |
2023-12-18T13:02:26 Z |
dwuy |
Rice Hub (IOI11_ricehub) |
C++14 |
|
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 ""
#define int long long
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;
int n, l, money;
int a[MX];
int sum[MX];
int get(int l, int r){
return sum[r] - sum[l-1];
}
int cost(int l, int r){
int mid = (l+r)>>1;
return get(mid+1, r) - get(l, mid - ((r-l+1)&1));
}
int besthub(int N, int L, int X[], int B){
n = N;
l = L;
money = B;
for(int i=1; i<=n; i++){
a[i] = X[i-1];
sum[i] = sum[i-1] + a[i];
}
int ans = 0;
for(int 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/ccOljIKC.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