제출 #93996

#제출 시각아이디문제언어결과실행 시간메모리
93996fjzzq2002쌀 창고 (IOI11_ricehub)C++14
100 / 100
222 ms2664 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll qz[123456]; int besthub(int N,int L_,int X[],ll B) { int ans=0; for(int i=0;i<N;++i) qz[i+1]=qz[i]+X[i]; for(int i=0;i<N;++i) { int u=X[i]; int L=0,R=1.01e9; while(L<R) { int M=(L+R+1)>>1; int u1=lower_bound(X,X+N,u-M)-X, u2=lower_bound(X,X+N,u+M+1)-X-1; //[u1,i] [i,u2] ll co=(i-u1+1)*ll(u)-(qz[i+1]-qz[u1]) +(qz[u2+1]-qz[i])-(u2-i+1)*ll(u); int cn=u2-u1+1; if(co>B) R=M-1; else L=M; } { int M=L; int u1=lower_bound(X,X+N,u-M)-X, u2=lower_bound(X,X+N,u+M+1)-X-1; //[u1,i] [i,u2] ll co=(i-u1+1)*ll(u)-(qz[i+1]-qz[u1]) +(qz[u2+1]-qz[i])-(u2-i+1)*ll(u); int cn=u2-u1+1; ll w=B-co; if(cn!=N) cn+=w/(M+1); ans=max(ans,cn); } } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

ricehub.cpp: In function 'int besthub(int, int, int*, ll)':
ricehub.cpp:23:8: warning: unused variable 'cn' [-Wunused-variable]
    int cn=u2-u1+1;
        ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...