제출 #1126051

#제출 시각아이디문제언어결과실행 시간메모리
1126051m_bezrutchka쌀 창고 (IOI11_ricehub)C++20
42 / 100
1088 ms328 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; int besthub(int R, int L, int X[], long long B) { // sub1 int resp = 0; for (int hub = 1; hub <= L; hub++) { vector<int> dists; for (int i = 0; i < R; i++) { dists.push_back(abs(X[i] - hub)); } sort(dists.begin(), dists.end()); int cur_resp = 0; int money = B; for (int i = 0; i < R; i++) { if (dists[i] > money) break; cur_resp++; money -= dists[i]; } resp = max(cur_resp, resp); } return resp; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...