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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <iterator>
#include "ricehub.h"
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
int p = 0, q = 0, res = 0;
long long c = 0;
for(int i = 0; i < R; i++)
{
if(i)
c += 1LL * ((i - p) - (q - i)) * (X[i] - X[i - 1]);
while(c > B)
c -= X[i] - X[p++];
while(q < R && (X[q] - X[i] <= X[i] - X[p] || c + X[q] - X[i] <= B))
{
c += X[q++] - X[i];
while(c > B)
c -= X[i] - X[p++];
}
res = max(res, q - p);
}
return res;
}
# | 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... |