이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
int besthub(int R, int L, int X[], long long B) {
vector<long long> dp (R+1, 0);
for (int i = 0; i < R; i++) {
dp[i+1] = dp[i]+X[i];
}
long long poc=1, kon=1;
long long score = 0;
while (kon <= R) {
int sr = (poc+kon)/2;
if (!((kon-poc)%2)) {
long long s = dp[kon]-dp[sr]-dp[sr-1]+dp[poc-1];
if (s <= B) {
score = max(score, kon-poc+1);
kon++;
}
else {
poc++;
}
}
else {
long long s = dp[kon]-dp[sr]*2+dp[poc-1];
if (s <= B) {
score = max(score, kon-poc+1);
kon++;
}
else {
poc++;
}
}
}
return score;
}
# | 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... |