제출 #724759

#제출 시각아이디문제언어결과실행 시간메모리
724759Yell0쌀 창고 (IOI11_ricehub)C++17
100 / 100
16 ms972 KiB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int besthub(int R,int L,int X[],ll B) {
  int ans=1;
  ll cost=0;
  for(int l=0,r=0;r<R;++r) {
    cost+=X[r]-X[(l+r)/2];
    while(cost>B) cost-=X[(l+r+1)/2]-X[l++];
    ans=max(ans,r-l+1);
  }
  return ans;
}

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

ricehub.cpp: In function 'int besthub(int, int, int*, ll)':
ricehub.cpp:11:41: warning: operation on 'l' may be undefined [-Wsequence-point]
   11 |     while(cost>B) cost-=X[(l+r+1)/2]-X[l++];
      |                                        ~^~
ricehub.cpp:11:41: warning: operation on 'l' may be undefined [-Wsequence-point]
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...