Submission #411326

#TimeUsernameProblemLanguageResultExecution timeMemory
411326jeqchoRice Hub (IOI11_ricehub)C++17
68 / 100
1097 ms704 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<pair<int,int>> vpi; #define FOR(i,a,b) for (int i = (a); i < (b); ++i) #define F0R(i,a) FOR(i,0,a) #define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i) #define R0F(i,a) ROF(i,0,a) #define trav(a,x) for (auto& a: x) #define pb push_back #define rsz resize #define sz(x) int(x.size()) #define all(x) begin(x), end(x) #define fi first // subtask 1,2 int besthub(int R, int L, int X[], ll B){ int mx=0; F0R(i,R) { int x = X[i]; vi cost; F0R(i,R) { cost.pb(abs(X[i]-x)); } sort(all(cost)); ll cur=0; int cand=0; F0R(i,R) { if(cur+(ll)cost[i]>B)break; cur+=(ll)cost[i]; ++cand; } mx=max(mx,cand); } 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...