# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
820106 | nemethm | Rice Hub (IOI11_ricehub) | C++17 | 1070 ms | 608 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
int besthub(int R, int L, int X[], long long B)
{
int ans = 0;
for(int i = 0; i < R; ++i){
vector<int> q;
for(int j = 0; j < R; ++j){
q.push_back(abs(X[i] - X[j]));
}
sort(begin(q), end(q));
ll cost = 0;
int actual = 0;
int j = 0;
while(j < q.size() && cost + q[j] <= B){
++actual;
cost += q[j];
++j;
}
ans = max(ans, actual);
}
return ans;
}
Compilation message (stderr)
# | 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... |