이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "ricehub.h"
#include <bits/stdc++.h>
#ifdef GUDEB
#define D(x) cerr << #x << ": " << (x) << '\n';
#define ifdeb if(true)
#else
#define D(x) ;
#define ifdeb if(false)
#endif
#define all(x) begin(x), end(x)
using namespace std;
using ull = unsigned long long;
using ll = long long;
// #define int ll;
int besthub(int R, int L, int X[], long long B) {
int l = 0;
int m = 0;
int r = 0;
ll c = 0;
int best = 1;
while(r < R) {
++r;
c += X[r-1] - X[m];
D(l)
D(m)
D(r)
D(c)
while(m < (l+r)/2) {
c += 1ll*(X[m+1] - X[m])*(2*m-l-r+2);
++m;
}
while(c > B) {
c -= X[m] - X[l];
++l;
while(m < (l+r)/2) {
c += 1ll*(X[m+1] - X[m])*(2*m-l-r+2);
++m;
}
}
best = max(best, r-l);
}
return best;
}
# | 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... |