| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 533720 | Gurban | Rice Hub (IOI11_ricehub) | C++17 | 4 ms | 696 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxn=1e5+5;
ll p[maxn],b;
int a[maxn];
bool check(int l,int r){
int md = (l + r) >> 1;
ll val = 1ll * a[md] * (md - l);
if(md-1 >= 0) val -= p[md-1];
if(l-1 >= 0) val += p[l-1];
val += p[r] - p[md];
val -= 1ll * a[md] * (r - md);
return (val <= b);
}
int besthub(int R,int L,int X[],ll B){
for(int i = 0;i < R;i++) a[i] = X[i];
b = B;
p[0] = X[0];
for(int i = 1;i < R;i++) p[i] = p[i - 1] + X[i];
int ans = 0;
for(int i = 0;i < R;i++){
int l = 0,r = i - 1,md,jg=i;
while(l <= r){
md = (l + r) >> 1;
if(check(md,r)) jg=md,r=md-1;
else l=md+1;
}
ans = max(ans,i-md+1);
}
return ans;
}
// int main(){
// ios::sync_with_stdio(false);
// cin.tie(0);
// int r,l,b;
// int x[100];
// cin >> r >> l >> b;
// for(int i = 0;i < r;i++) cin >> x[i];
// return cout<<besthub(r,l,x,b),0;
// }
컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
