Submission #1249348

#TimeUsernameProblemLanguageResultExecution timeMemory
1249348_HDHRice Hub (IOI11_ricehub)C++20
42 / 100
1095 ms428 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; int besthub(int R, int L, int X[], long long B) { int ans = 0; for (int j = 1; j <= L; j++){ vector<int> vt; for (int i = 0; i < R; i++){ vt.push_back(abs(X[i] - j)); } sort(vt.begin(), vt.end()); int sum = 0; int k = 0; while (k < vt.size() && sum + vt[k] <= B) sum += vt[k++]; ans = max(ans, k); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...