Submission #1010812

#TimeUsernameProblemLanguageResultExecution timeMemory
1010812MuhammetRice Hub (IOI11_ricehub)C++17
17 / 100
1028 ms1372 KiB
#include <bits/stdc++.h>
#include "ricehub.h"

#define sz(s) (int)s.size()

using namespace std;

#define ll long long

int besthub(int n, int l, int a[], ll b){
    multiset <ll> s;
    ll ans = 0;
    for(int i = 0; i < n; i++){
        s.clear();
        for(int j = 0; j < n; j++){
            if(a[i] != a[j]){
                s.insert(abs(a[i]-a[j]));
            }
        }
        ll b1 = b, x = 0;
        while(b1 > 0 and sz(s) > 0){
            ll k = *s.begin();
            s.erase(s.begin());
            if(b1 < k) break;
            b1 -= k;
            x++;
        }
        ans = max(ans,x);
    }
    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...