이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "ricehub.h"
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <chrono>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <iomanip>
#include <queue>
#include <bitset>
#include <cmath>
#include <cassert>
typedef long long ll;
typedef long double ld;
using namespace std;
const int maxr = 1e5 + 5;
ll pf[maxr];
ll sum(int l, int r)
{
return pf[r + 1] - pf[l];
}
bool check(int r, int l, ll b, int k)
{
for (int i = 0; i + k <= r; i++)
{
ll s = sum(i + k - k / 2, i + k - 1) - sum(i, i + k / 2 - 1);
if (s <= b) return true;
}
return false;
}
int besthub(int r, int l, int x[], ll b)
{
for (int i = 0; i <= r; i++) pf[i + 1] = pf[i] + x[i];
int lo = 1, hi = r;
while (lo < hi)
{
int mi = (lo + hi + 1) / 2;
if (check(r, l, b, mi)) lo = mi;
else hi = mi - 1;
}
return lo;
}
# | 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... |