Submission #724759

#TimeUsernameProblemLanguageResultExecution timeMemory
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; }

Compilation message (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...