Submission #986314

#TimeUsernameProblemLanguageResultExecution timeMemory
986314PyqeRice Hub (IOI11_ricehub)C++17
100 / 100
11 ms3676 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; long long ps[100069],inf=1e18; int besthub(int n,int ln,int a[],long long d) { long long i,lh,rh,md,zz,mn; for(i=1;i<=n;i++) { ps[i]=ps[i-1]+a[i-1]; } for(lh=1,rh=n;lh<=rh;) { md=(lh+rh)/2; mn=inf; for(i=md;i<=n;i++) { mn=min(mn,ps[i]-ps[i-md/2]-ps[i-md+md/2]+ps[i-md]); } if(mn<=d) { zz=md; lh=md+1; } else { rh=md-1; } } return zz; }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:34:9: warning: 'zz' may be used uninitialized in this function [-Wmaybe-uninitialized]
   34 |  return zz;
      |         ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...