제출 #306002

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
3060022020-09-24 09:28:06vipghn2003Rice Hub (IOI11_ricehub)C++14
100 / 100
114 ms2948 KiB
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int a[N];
long long s[N];
long long cost(int i,int l,int r)
{
if(l>r) return 0;
return 1ll*a[i]*(i-l)-(s[i-1]-s[l-1])+(s[r]-s[i])-1ll*a[i]*(r-i);
}
int besthub(int R,int L,int X[],long long B)
{
for(int i=1;i<=R;i++)
{
a[i]=X[i-1];
s[i]=s[i-1]+a[i];
}
int ans=0;
for(int i=1;i<=R;i++)
{
int pos=a[i];
int l=i,r=R,res=-1;
while(l<=r)
{
int mid=(l+r)/2;
int v=mid;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:55:24: warning: 'id' may be used uninitialized in this function [-Wmaybe-uninitialized]
   55 |         ans=max(ans,res-id+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...