#include<bits/stdc++.h>
#include "ricehub.h"
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
int mx = -1;
for(int i=0;i<=R;++i)
{
priority_queue<long long,vector<long long>,greater<long long>> pq;
for(int j=0;j<R;++j)
{
if(i == j) continue;
long long dist = abs(X[i]-X[j]);
pq.push(dist);
}
long long cost = 0;
int rice = 0;
while(!pq.empty())
{
if(cost+pq.top() <= B)
{
cost += pq.top();
++rice;
}
else break;
pq.pop();
}
mx = max(mx,rice);
}
return mx;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1062 ms |
928 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |