Submission #655202

#TimeUsernameProblemLanguageResultExecution timeMemory
655202TrumlingRice Hub (IOI11_ricehub)C++17
42 / 100
1088 ms1236 KiB
#include "ricehub.h" #include<iostream> #include<cmath> using namespace std; typedef long long ll; #define pb push_back #define F first #define S second #define enter cout<<'\n'; int besthub(int R, int L, int X[], long long B) { bool arr[L+1]={ }; for(int i=0;i<R;i++) { arr[X[i]]=true; } ll ans=1; ll count=0; ll plus=R; while(plus!=1) { if(ans!=1) break; for(int i=0;i<=R-plus;i++) { ll med=(i+i+plus)/2; ll curr=0; for(int j=i;j<i+plus;j++) curr+=abs(X[med]-X[j]); if(curr<=B) { ans=plus; break; } } plus--; } //cout<<'\n'<<ans<<'\n'; return ans; }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:20:4: warning: unused variable 'count' [-Wunused-variable]
   20 | ll count=0;
      |    ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...