Submission #1221136

#TimeUsernameProblemLanguageResultExecution timeMemory
1221136SpyrosAlivRice Hub (IOI11_ricehub)C++20
68 / 100
1094 ms800 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int besthub(int R, int L, int X[], ll B) {
    vector<int> coords;
    int n = R;
    ll b = B;
    for (int i = 0; i < n; i++) coords.push_back(X[i]);
    int maxAns = 0;
    for (int i = 0; i < n; i++) {
        vector<int> dis;
        for (int j = 0; j < n; j++) {
            dis.push_back(abs(coords[i] - coords[j]));
        }
        sort(dis.begin(), dis.end());
        ll curr = 0;
        int tot = 0;
        for (int i = 0; i < n; i++) {
            curr += dis[i];
            if (curr > b) break;
            tot++;
        }
        maxAns = max(maxAns, tot);
    }
    return maxAns;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...