Submission #1003330

#TimeUsernameProblemLanguageResultExecution timeMemory
1003330hacizadalRice Hub (IOI11_ricehub)C++17
42 / 100
1062 ms1084 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long #define pll pair<ll, ll> int besthub(int n, int l, int a[], long long b) { ll mx = 0; for (ll i = 0; i<n; i++){ priority_queue<ll, vector<ll>, greater<ll>>pq; for (ll j = 0; j<n; j++){ pq.push(abs(a[j] - a[i])); } ll sum = 0, cnt = 0; while (pq.size()){ ll x = pq.top(); pq.pop(); sum += x; cnt++; if (sum > b){ sum -= x; cnt--; break; } } mx = max(mx, cnt); } 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...