Submission #783160

#TimeUsernameProblemLanguageResultExecution timeMemory
783160Minindu206Rice Hub (IOI11_ricehub)C++14
43 / 100
1074 ms612 KiB
#include "ricehub.h" #include<bits/stdc++.h> #define ll long long using namespace std; int besthub(int r, int l, int x[], long long b) { int ans = 0; for(int i=0;i<r;i++) { vector<int> cost; for(int j=0;j<r;j++) cost.push_back(abs(x[i] - x[j])); sort(cost.begin(), cost.end()); ll sum = 0; int cur = 0; while(sum < b) { if(cur >= r) break; sum += cost[cur]; cur++; } if(sum > b) cur--; ans = max(ans, cur); } 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...