제출 #783163

#제출 시각아이디문제언어결과실행 시간메모리
783163Minindu206쌀 창고 (IOI11_ricehub)C++14
68 / 100
1078 ms648 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...