#include "ricehub.h"
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int besthub(int r, int l, int x[], long long b)
{
int cost[r];
int ans = 0;
for(int i=0;i<l;i++)
{
for(int j=0;j<r;j++)
cost[j] = (abs(i - x[j]));
sort(cost, cost + r);
ll sum = 0;
int cur = 0;
while(sum < b)
{
if(cur >= r)
break;
sum += cost[cur];
cur++;
}
if(sum > b)
cur--;
ans = max(ans, cur);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
308 KB |
Output is correct |
2 |
Correct |
14 ms |
304 KB |
Output is correct |
3 |
Execution timed out |
1067 ms |
212 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1063 ms |
340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |