Submission #743300

#TimeUsernameProblemLanguageResultExecution timeMemory
743300vjudge1Rice Hub (IOI11_ricehub)C++17
42 / 100
1084 ms656 KiB
#include<bits/stdc++.h> #include "ricehub.h" using namespace std; int besthub(int R, int L, int X[], long long B) { long long mx = -1; for(int i=1;i<=L;++i) { priority_queue<int,vector<int>,greater<int>> pq; for(int j=0;j<R;++j) { int dist = abs(i-X[j]); pq.push(dist); } long long cost = 0,rice = 0; while(!pq.empty()) { // cout << "+" << pq.top() << '\n'; if(cost+pq.top() <= B) { cost += pq.top(); ++rice; } else break; pq.pop(); } mx = max(mx,rice); } return mx; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...