Submission #1327708

#TimeUsernameProblemLanguageResultExecution timeMemory
1327708arman.khachatryan쌀 창고 (IOI11_ricehub)C++20
0 / 100
1 ms332 KiB
#include <bits/stdc++.h>
using namespace std;
long long besthub(int r, int l, int* a, long long b){
    int j, k, ans=0, cnt;
    long long c;
    for(int i=0; i<r; i++){
        j=i-1;
        k=i+1;
        cnt=0;
        c=b;
        while(c>0){
            if(0<=j && (k>=r || a[i]-a[j]<=a[k]-a[i])){
                j--;
                cnt++;
                c-=(a[i]-a[j])*1LL;
            }else if(k<r && (j<0 || a[i]-a[j]>=a[k]-a[i])){
                k++;
                cnt++;
                c-=(a[k]-a[i])*1LL;
            }
        }
        ans=max(ans, cnt);
    }
    return ans+1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...