Submission #715526

#TimeUsernameProblemLanguageResultExecution timeMemory
715526vjudge1Rice Hub (IOI11_ricehub)C++11
42 / 100
1072 ms1740 KiB
#include <bits/stdc++.h>
#include "ricehub.h"
#define ll long long
using namespace std;
//int r,l;
//ll d;
//int x[100005];
int besthub(int R, int L, int X[], long long B)
{
    int ans=0;
    for(int i=1;i<R-1;i++)
    {
        int cnt=0;
        ll b=B;
        priority_queue<ll,vector<ll>,greater<ll>> pq;
        for(int j=0;j<R;j++)
            pq.push(abs(X[j]-X[i]));
        while(!pq.empty())
        {
            if(b-pq.top()<0)
                break;
            b-=pq.top();
            pq.pop();
            cnt++;
        }
        ans=max(ans,cnt);
    }
    return ans;
}
//int main()
//{
//    cin >> r >> l >> d;
//    for(int i=0;i<r;i++)
//        cin >> x[i];
//    cout << besthub(r,l,x,d);
//    return 0;
//}
/**
5 20 6
1 2 10 12 14
**/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...