Submission #261536

#TimeUsernameProblemLanguageResultExecution timeMemory
261536s_avila_gRice Hub (IOI11_ricehub)C++14
42 / 100
1068 ms768 KiB
#include <bits/stdc++.h> using namespace std; #include "ricehub.h" typedef long long ll; priority_queue<int,vector<int>, greater<int> > pq; int besthub(int R, int L, int X[],ll B){ ll n = R, ans = -1, act, sum; for(ll i = 1; i < L; i++){ for(ll j = 0; j < n; j++){ pq.push(abs(i - X[j])); } sum = act = 0; while(!pq.empty()){ if(sum + pq.top() > B){ pq.pop(); continue; }else{ sum += pq.top(); act++; } pq.pop(); } ans = max(ans,act); } 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...