I have been looking into this: https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=78&page=show_problem&problem=2680
In short, the model is that you are given a set of integers $y_1,y_2,\ldots,y_n,$ and a constant $\alpha,$ all positive, and you are to find a numbers $S$ to minimize the following expression:
$$\alpha\sum_{i=1}^{n}S\lceil{}y_i/S\rceil{} + \sum_{i=1}^{n}\lceil{}y_i/S\rceil{}$$ subject to the constraint that $\lceil{}y_i/S\rceil{} \leq 3,$ for all $i.$
This is of course what the problem boils down to once you separate wheat from the chaff. I can see why $S$ has always to be a rational number -- since we take a ceiling, for fixed $\lceil{}y_i/S\rceil{}$ we only increase the value if $S$ is replaced by $S+\epsilon$. Also, given is a condition (found in the problem statement above) that $y_i \leq 100$ for all $i,$ hence we can afford some reasonable brute forcing. The matter is just how to narrow the range of suspects. I know that if $a/b < c/d,$ then $a / b < (a+c)/(b+d) < c/d,$ but then again there are infinitely many rationals between any two numbers.
EDIT: I tried to think along the lines suggested by Daniel Mathias, and here are my thoughts. Indeed, here $n \leq 1000,$ and the $y_i$-values are luckily bounded above by $100,$ so we can do the following. First observation is the the maximum portion size is $Y = \max_{i}\{y_i\},$ and hence each of the possible values $v = 1,2,\ldots,100$ can be mapped to a certain interval $[l_v,Y]$ such that a portion size is "good" iff it comes from this interval. Furthermore, each such interval can be split into three by two break-points -- where the corresponding $\mathtt{ceil}(v/S)$ transitions from $3$ to $2,$ and from $2$ to $1.$ Now, the good news is that there are at most $4$ such "interesting" points per possible value $v,$ which gives overall $4\times{}100$ points to check. Each check amounts to computing the above sum, where we also aggregate the values of $y_i$ and therefore the above sum is computed in $O(Y),$ which is better than $O(N),$ as $Y \leq 100.$ Hence we do four million operations, which is closer to fitting the time limit. The challenge here is to figure out a good "approximation" to rationals, because generally speaking the points of interest are not necessarily rational.
EDIT: In the above edit, we can take take two rationals -- one is at most the breakpoint, the other is strictly greater, and then we'll have at most 6-8 points of interest per possible value of $y_i,$ and hence this is a hopeful. I'll try to implement this now.
EDIT: The above idea worked, with some twists. I got Accepted.