제출 #355600

#제출 시각아이디문제언어결과실행 시간메모리
355600David_MRice Hub (IOI11_ricehub)C++14
100 / 100
18 ms1644 KiB
#include "ricehub.h" #include<bits/stdc++.h> using namespace std; int besthub(int R,int L,int X[],long long B){ long long ans=0, pref[100005], l=0, r=0, m, b; for (int i=0; i<R; i++)pref[i]=X[i]+(!!i)*pref[i-1]; for (;r<R;r++){ while(l<r){ m=l+r>>1; b=pref[r]+(!!l)*pref[l-1]-(pref[m]<<1); if((l+r+1)&1)b+=X[m]; if(b<=B)break; l++; } if(r-l>ans)ans=r-l; } return ans+1; }

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

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:9:7: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
    9 |    m=l+r>>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...