#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
int besthub(int R, int L, int X[], long long B) {
int mx = 0;
for (int i = 0; i < R; i++) {
vector<int> dist;
for (int j = i; j < R; j++) {
dist.emplace_back( abs (X[i] - X[j] ) );
}
sort (dist.begin(), dist.end());
long long cur = B;
int got = 0;
for (int i = 0; i < R; i++) {
if (cur - dist[i] >= 0) {
cur -= dist[i];
++got;
} else break;
}
mx = max (mx, got);
}
return mx;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1041 ms |
976 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |