이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 1e5;
int N, L, X[MAXN+10], ans=1;
ll B;
int besthub(int RR, int LL, int XX[], ll BB)
{
int i, j;
N=RR; L=LL; B=BB;
for(i=0; i<N; i++) X[i]=XX[i];
ll cost=0;
int lp=0, rp=0;
for(; lp<N; lp++)
{
//printf("%d %d %lld\n", lp, rp, cost);
for(; rp<N && cost<=B; rp++)
{
//printf("%d %d %lld\n", lp, rp, cost);
ans=max(ans, rp-lp+1);
int mid=(lp+rp+1)>>1;
cost+=X[rp+1]-X[mid];
}
//printf("%d %d %lld\n", lp, rp, cost);
int mid=(lp+rp+1)>>1;
cost-=X[mid]-X[lp];
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
ricehub.cpp: In function 'int besthub(int, int, int*, ll)':
ricehub.cpp:15:12: warning: unused variable 'j' [-Wunused-variable]
int i, j;
^| # | 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... |