이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int besthub(int r, int l, int x[], long long b) {
if (r > 5000) {
return 0;
}
int ans = 0, tempans;
vector<int> dis;
ll counter;
for (int i=0;i<r;i++) {
dis.clear(); counter = 0; tempans = 0;
for (int j=0;j<r;j++) {
dis.push_back(abs(x[i] - x[j]));
}
dis.push_back(INT32_MAX);
sort(dis.begin(),dis.end());
for (int j: dis) {
if (j == INT32_MAX || counter > b) {
tempans--;
break;
}
counter += j; tempans++;
}
ans = max(ans, tempans);
}
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... |