이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
///
/// There's a reason for your defeat, DIO. One simple reason...
/// You pissed me off.
///
#include <bits/stdc++.h>
#define Loop(x,l,r) for(ll x = ll(l); x < ll(r); ++x)
#define LoopR(x,l,r) for(ll x = ll(r)-1; x >= ll(l); --x)
#define Kill(x) exit((cout << (x) << '\n', 0))
typedef long long ll;
typedef std::pair<int,int> pii;
typedef std::pair<ll,ll> pll;
using namespace std;
#ifndef DARD
#include "ricehub.h"
#endif
int besthub(int r, int l, int x[], long long b)
{
int ans = 0;
ll cur = 0;
for (int i=0, j=0; j < r;) {
cur += x[j++];
cur -= x[(j+i-1)/2];
// cout << i << ' ' << j << ' ' << cur << '\n';
while (cur > b) {
cur += x[i++];
cur -= x[(j+i-1)/2];
}
// cout << i << ' ' << j << ' ' << cur << '\n';
ans = max(ans, j-i);
}
return ans;
}
#ifdef DARD
int main()
{
int constexpr r = 5;
int constexpr l = 20;
ll constexpr b = 6;
int x[] = {1, 2, 10, 12, 14};
cout << besthub(r, l, x, b) << '\n';
}
#endif
| # | 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... |