#include "ricehub.h"
#include <bits/stdc++.h>
#define PB push_back
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long i64;
int n;
int bound; //inclusive
i64 b;
vector<int> x;
bool feasible(int coor){
i64 cost = 0;
for(int i = 0; i < n; i++){
cost += ((i64) x[i] - coor);
if(cost > b) return 0;
}
return 1;
}
int solve(){
int l = 1, r = bound;
while (l + 1 < r){
int m = (l + r) >> 1;
if (feasible(m)){
l = m;
}
else r = m - 1;
}
return l;
}
int besthub(int R, int L, int X[], long long B){
for (int i = 0; i < R; i++) x.PB(X[i]);
bound = L;
n = R;
b = B;
return solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
760 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |