Submission #557195

#TimeUsernameProblemLanguageResultExecution timeMemory
557195n0sk1llRice Hub (IOI11_ricehub)C++14
0 / 100
2 ms340 KiB
#include "ricehub.h" #include<bits/stdc++.h> using namespace std; long long int typedef li; int besthub(int n, int m, int x[], li b) { int mx=0,l=0,r=0; li t=0; while (r<n) { t+=x[r++]-x[(l+r)/2]; while (t>b) t-=x[(l+r)/2]-x[l++]; mx=max(mx,r-l); } return mx; }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, li)':
ricehub.cpp:12:15: warning: operation on 'r' may be undefined [-Wsequence-point]
   12 |         t+=x[r++]-x[(l+r)/2];
      |              ~^~
ricehub.cpp:12:15: warning: operation on 'r' may be undefined [-Wsequence-point]
ricehub.cpp:13:38: warning: operation on 'l' may be undefined [-Wsequence-point]
   13 |         while (t>b) t-=x[(l+r)/2]-x[l++];
      |                                     ~^~
ricehub.cpp:13:38: 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...