Submission #1003266

#TimeUsernameProblemLanguageResultExecution timeMemory
1003266ayankarimovaRice Hub (IOI11_ricehub)C++14
68 / 100
1085 ms940 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long const ll sz=50005; ll a[sz], b[sz], d[sz], s[sz]; int besthub(int r, int l, int x[], long long k) { ll ans=0; for(int i=0; i<r; i++){ vector<ll>v; for(int j=0; j<r; j++){ v.push_back(abs(x[i]-x[j])); } sort(v.begin(), v.end()); ll sum=0; for(int j=0; j<r; j++){ if(sum+v[j]>k) break; sum+=v[j]; ans=max(ans, (ll)j+1); } } return ans; } /* {} [] 5 20 6 1 2 10 12 14 3 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...