# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
224630 | 2020-04-18T14:14:27 Z | DanerZein | Rice Hub (IOI11_ricehub) | C++14 | 1000 ms | 860 KB |
#include "ricehub.h" #include <bits/stdc++.h> #define MAX_R 1000000 using namespace std; static int R, L; static long long B; static int X[MAX_R]; static int solution; inline void my_assert(int e) {if (!e) abort();} int besthub(int R,int L,int X[], long long B){ // cout<<"a"<<endl; long long ma=-1; for(int i=0;i<R;i++){ for(int j=i;j<R;j++){ // cout<<i<<" "<<j<<endl; vector<int>rp; for(int k=i;k<=j;k++){ rp.push_back(X[k]); } int mi=(i+j)/2; mi=X[mi]; // cout<<i<<" "<<j<<endl; bool sw=0; long long b=B; for(int k=0;k<rp.size();k++){ if(b<=0){ sw=1; break; } b-=abs(mi-rp[k]); //c++; } if(sw==0){ // cout<<i<<" "<<j<<" "<<rp.size()<<endl; long long tam=rp.size(); ma=max(ma,tam); } } } return ma; }/* static void read_input() { int i; my_assert(3==scanf("%d %d %lld",&R,&L,&B)); for(i=0; i<R; i++) my_assert(1==scanf("%d",&X[i])); my_assert(1==scanf("%d",&solution)); } int main(){ int R,L,B,X[100]; cin>>R>>L>>B; for(int i=0;i<R;i++){ int a; cin>>a; X[i]=a; } cout<<besthub(R,L,X,B)<<endl; } */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 12 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1093 ms | 860 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |