# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
234050 | 2020-05-22T22:45:09 Z | DanerZein | Rice Hub (IOI11_ricehub) | C++14 | 1000 ms | 1912 KB |
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; long long ma=-1; int besthub(int R, int L, int X[], long long B){ if(R<=500){ 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++){ b-=abs(mi-rp[k]); if(b<0){ sw=1; break; } //c++; } if(sw==0){ // cout<<i<<" "<<j<<" "<<rp.size()<<endl; long long tam=rp.size(); ma=max(ma,tam); } } } return ma; } else{ vector<ll>T; T.push_back(0); for(int i=0;i<R;i++){ T.push_back(X[i]+T[T.size()-1]); } for(int i=0;i<R;i++){ for(int j=i+1;j<R;j++){ ll mi=(i+j)/2; if((mi-i)*X[mi]-(T[mi]-T[i])+(T[j+1]-T[mi+1])-(j-mi)*X[mi]<=B){ ma=max(ma,(ll)(j-i)+1); } } } return ma;} }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 6 ms | 256 KB | Output is correct |
5 | Correct | 6 ms | 128 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 256 KB | Output is correct |
7 | Correct | 6 ms | 256 KB | Output is correct |
8 | Correct | 6 ms | 256 KB | Output is correct |
9 | Correct | 4 ms | 256 KB | Output is correct |
10 | Correct | 4 ms | 256 KB | Output is correct |
11 | Correct | 5 ms | 256 KB | Output is correct |
12 | Correct | 5 ms | 256 KB | Output is correct |
13 | Correct | 5 ms | 256 KB | Output is correct |
14 | Correct | 5 ms | 512 KB | Output is correct |
15 | Correct | 6 ms | 256 KB | Output is correct |
16 | Correct | 6 ms | 384 KB | Output is correct |
17 | Correct | 5 ms | 384 KB | Output is correct |
18 | Correct | 5 ms | 256 KB | Output is correct |
19 | Correct | 6 ms | 256 KB | Output is correct |
20 | Correct | 6 ms | 256 KB | Output is correct |
21 | Correct | 102 ms | 376 KB | Output is correct |
22 | Correct | 101 ms | 504 KB | Output is correct |
23 | Correct | 121 ms | 376 KB | Output is correct |
24 | Correct | 119 ms | 376 KB | Output is correct |
25 | Correct | 120 ms | 384 KB | Output is correct |
26 | Correct | 120 ms | 376 KB | Output is correct |
27 | Correct | 110 ms | 384 KB | Output is correct |
28 | Correct | 108 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 384 KB | Output is correct |
2 | Correct | 11 ms | 384 KB | Output is correct |
3 | Correct | 6 ms | 384 KB | Output is correct |
4 | Correct | 6 ms | 384 KB | Output is correct |
5 | Correct | 95 ms | 256 KB | Output is correct |
6 | Correct | 96 ms | 404 KB | Output is correct |
7 | Correct | 6 ms | 384 KB | Output is correct |
8 | Correct | 7 ms | 384 KB | Output is correct |
9 | Correct | 102 ms | 256 KB | Output is correct |
10 | Correct | 102 ms | 376 KB | Output is correct |
11 | Correct | 6 ms | 384 KB | Output is correct |
12 | Correct | 6 ms | 384 KB | Output is correct |
13 | Correct | 6 ms | 384 KB | Output is correct |
14 | Correct | 6 ms | 384 KB | Output is correct |
15 | Correct | 114 ms | 256 KB | Output is correct |
16 | Correct | 117 ms | 376 KB | Output is correct |
17 | Correct | 6 ms | 384 KB | Output is correct |
18 | Correct | 6 ms | 384 KB | Output is correct |
19 | Correct | 6 ms | 384 KB | Output is correct |
20 | Correct | 6 ms | 384 KB | Output is correct |
21 | Correct | 36 ms | 384 KB | Output is correct |
22 | Correct | 36 ms | 384 KB | Output is correct |
23 | Correct | 44 ms | 384 KB | Output is correct |
24 | Correct | 44 ms | 492 KB | Output is correct |
25 | Correct | 44 ms | 384 KB | Output is correct |
26 | Correct | 44 ms | 384 KB | Output is correct |
27 | Correct | 42 ms | 504 KB | Output is correct |
28 | Correct | 42 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 478 ms | 768 KB | Output is correct |
2 | Correct | 483 ms | 768 KB | Output is correct |
3 | Execution timed out | 1093 ms | 1912 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |