| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1327827 | arman.khachatryan | Rice Hub (IOI11_ricehub) | C++20 | 0 ms | 332 KiB |
#include <bits/stdc++.h>
using namespace std;
long long besthub(int r, int l, int* a, long long b){
int j, k=1, ans=0, cntj, cntk=1;
long long cj, ck=0;
bool bl;
for(int i=0; i<r; i++){
j=i-1;
cj=0;
cntj=0;
cntk--;
bl=true;
if(k<=i){
k=i+1;
ck=0;
cntk=1;
}
while(cj+ck<=b && bl && (j>=0 || k<r)){
if(0<=j && (k>=r || a[i]-a[j]<=a[k]-a[i])){
if(b<a[i]-a[j]+cj+ck){
bl=false;
continue;
}
cj+=(a[i]-a[j])*1LL;
j--;
cntj++;
}
if(k<r && (j<0 || a[i]-a[j]>=a[k]-a[i]) ){
if(b<a[k]-a[i]+cj+ck){
bl=false;
continue;
}
ck+=(a[k]-a[i])*1LL;
k++;
cntk++;
}
}
ans=max(ans, cntj+cntk);
if(i+1<r){
ck-=(k-i)*(a[i+1]-a[i]);
}
}
return ans;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
