# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1193066 | Nomio | Rice Hub (IOI11_ricehub) | C++20 | 0 ms | 0 KiB |
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int besthub(int R, int L, vector<int> X, int B) {
int ans = 0;
for(int i = 0; i < R; i++) {
vector<int> v;
for(int j = 0; j < R; j++) {
v.push_back(abs(X[i] - X[j]));
}
sort(v.begin(), v.end());
int cnt = 0, s = 0, j = -1;
while(s + v[j + 1] <= B) {
j++;
s += v[j];
cnt++;
}
ans = max(cnt, ans);
}
return ans;
}
//
//int main() {
// cout << besthub(5, 20, {1, 2, 10, 12, 14}, 6) << '\n';
//}