Submission #1015325

#TimeUsernameProblemLanguageResultExecution timeMemory
1015325KasymKRice Hub (IOI11_ricehub)C++17
17 / 100
1041 ms856 KiB
#include "bits/stdc++.h" using namespace std; #define pb push_back #define ll long long #define ff first #define ss second #define all(v) v.begin(), v.end() int besthub(int r, int l, int x[], ll b){ ll b_ = b; vector<int> v; int ans = 0; for(int hub = 1; hub <= l; ++hub){ int sm = 0; for(int i = 0; i < r; ++i) v.pb(abs(hub-x[i])); sort(all(v)); reverse(all(v)); while(1){ if(b-v.back() >= 0) b -= v.back(), v.pop_back(), sm++; else break; } ans = max(ans, sm); v.clear(); b = b_; } return ans; } // const int N = 20; // int a[N]; // int main(){ // int r, l; // ll b; // scanf("%d %d %lld", &r, &l, &b); // for(int i = 0; i < r; ++i) // scanf("%d", &a[i]); // printf("%d\n", besthub(r, l, a, b)); // return 0; // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...