이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "ricehub.h"
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i, x, y) for(ll i=x; i<y; i++)
using namespace std;
int besthub(int R, int L, int X[], ll B){
sort(X, X+R);
ll med;
if (R%2==0) med = (X[R/2] + X[R/2-1])/2;
else med = X[R/2];
ll ans = 0;
int costs[100000];
FOR(i,0,R){
costs[i] = abs(X[i] - med);
}
sort(costs, costs+R);
FOR(i,0,R){
if (B - costs[i] >=0) ans++, B-= costs[i];
else break;
}
return ans;
}
| # | 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... |