| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 136415 | miguel | 쌀 창고 (IOI11_ricehub) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include<ricehub.h>
using namespace std;
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define int ll
#define x first
#define y second
#define pi pair <int, int>
#define pii pair <int, pi>
#define vi vector <int>
const ll mod = 998244353;
int besthub(int n, int l, int x[], int b){
int s[n+1];
int ans=0;
s[0]=x[0];
s[n]=1000000000000000000;
for(int i=1; i<n; i++) s[i]=s[i-1]+x[i];
for(int i=0; i<n; i++){
int l=0, r=n-i;
while(r-l>1){
int mid=(l+r)>>1;
int start=i, end=i+mid;
int xd=(start+end)/2;
if((x[xd]*(2*xd-start-end)-s[xd-1]+s[start-1]+s[end]-s[xd])<=b) l=mid;
else r=mid;
}
ans=max(ans, l);
}
return ans;
}
