Submission #388061

#TimeUsernameProblemLanguageResultExecution timeMemory
388061Pichon5Rice Hub (IOI11_ricehub)C++17
0 / 100
338 ms472 KiB
#include "ricehub.h" #include <bits/stdc++.h> #define vi vector<int> #define pb push_back #define ll long long int using namespace std; int besthub(int R, int L, int X[], long long B) { vi v; int res=0; for(int i=0;i<R;i++){ int b=i,e=R-1; while(b<=e){ int mid=(b+e)/2; v.clear(); for(int l=i;l<=mid;l++){ v.pb(X[l]); } int MID=v.size()/2; ll aux=0; for(int l=0;l<v.size();l++){ aux+=abs(v[l]-v[MID]); } if(aux<=B){ res=max(res,e-b+1); b=mid+1; }else{ e=mid-1; } } } return res; }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:21:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |             for(int l=0;l<v.size();l++){
      |                         ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...