| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 1003127 | rahidilbayramli | Rice Hub (IOI11_ricehub) | C++17 | 0 ms | 0 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "ricehub.h"
#define ll long long
#define ld long double
#define vl vector<ll>
#define vi vector<int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define f first
#define s second
#define pb push_back
#define p_b pop_back
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
    int n = R, i, j;
    int h[n+5];
    for(i = 1; i <= n; i++)
        h[i] = X[i-1];
    int res = 0;
    for(i = 1; i <= n; i++)
    {
        int g = 0;
        for(j = i + 1; j <= n; j++){
            g += (h[j] - h[j - 1]);
            if(g > B)
                break;
            res = max(res, j - i + 1);
        }
    }
    return res;
}
int main()
{
    int R, L;
    ll B;
    cin >> R >> L >> B;
    int X[R];
    for(int i = 0; i < R; i++)
        cin >> X[i];
    cout << besthub(R, L, X, B) << "\n";
}
