Submission #1325457

#TimeUsernameProblemLanguageResultExecution timeMemory
1325457kasamchiRice Hub (IOI11_ricehub)C++20
68 / 100
1095 ms568 KiB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;

int besthub(int R, int L, int X[], long long B) {
    int rr = 0, ret = 0;
    for (int ll = 0; ll < R; ll++) {
        while (rr < R) {
            long long b = 0;
            for (int i = ll; i <= rr; i++) {
                b += abs(X[i] - X[ll + (rr - ll) / 2]);
            }
            if (b > B) {
                break;
            }
            rr++;
        }
        ret = max(ret, rr - ll);
    }
    return ret;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...