# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
655217 | 2022-11-03T14:53:05 Z | Trumling | Rice Hub (IOI11_ricehub) | C++14 | 98 ms | 604 KB |
#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; bool pre=false; ll curr=0; cout<<'\n'; for(int i=0;i<=R-plus;i++) { ll med; if(!pre) { med=(i+i+plus)/2; for(int j=i;j<i+plus;j++) curr+=abs(X[med]-X[j]); pre=true; } else { curr-=abs(X[i-1]-X[med]); med++; ll dif=abs(X[med]-X[med-1]); curr=curr+abs(i-med)*dif; curr=curr-(plus-med)*dif; curr+=(X[med]-X[i+plus-1]); } //cout<<curr<<' '; if(curr<=B) { ans=plus; break; } } plus--; } //cout<<'\n'<<ans<<'\n'; return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 98 ms | 604 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |