This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//#include "ricehub.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,ans=1,curcost=0;
while (hi<R){
if ((hi-lo)%2==0 && hi!=lo) curcost += X[hi] - X[(hi-lo-1)/2+1 + lo];
else curcost += X[hi] - X[(hi-lo-1)/2 + lo];
if (curcost>B){
if ((hi-lo)%2==0) curcost += X[lo] -X[hi];
else curcost += X[lo] - X[hi];
lo ++;
} else hi++;
ans = max(ans, hi-lo);
}
return ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |