This is a draft proof (I am not strong on integration theory, and it's already 1 a.m here) that $\mathcal{A}$ is the pre-image by $\frac f g$ of some $]-\infty, M]$. It can be refined, notably on the hypotheses which are stronger than necessary.
Assume $\mathcal{A}$ can be any union of closed intervals in $[a,b]$.
Suppose $f$ and $g$ are continuous, and $g$ is never null. We then define $h =\frac f g$.
(If $g$ has null values but not $f$, the same reasoning can be done with $\frac g f$).
Then $\exists M$ such that $\min_{\mathcal{A}} \int_\mathcal{A} f(x) dx$ with $\int_\mathcal{A} f(x) dx = C$
is attained for $\mathcal{A} = h^{-1}(]-\infty, M])$.
Proof by contradiction: suppose $\mathcal{B}$ is not of the form $h^{-1}(]-\infty, M])$.
Call $N=\max_{x \in \mathcal{B}}\; h(x)$. Then, $h$ being continuous:
$\exists [c_1, c_2] \subset \mathcal{B},\quad \exists [d_1, d_2], \; [d_1,d_2] \cap \mathcal{B} = \emptyset,$
$\forall x \in [c_1,c_2], \forall y \in [d_1, d_2], h(y) < h(x) < N$.
Then define $\mathcal{D} = \mathcal{B}$ plus some part of $[d_1, d_2]$ minus some part of [c_1, c_2], such that $\int_\mathcal{D} g(x) dx = \int_\mathcal{B} g(x) dx = C$ and
$\int_\mathcal{D} f(x) dx < \int_\mathcal{B} f(x) dx$
This is possible because $\frac {f(x)} {g(x)}$ is lower in $[d_1, d_2]$ than in $[c_1, c_2]$.
Notes:
- Numerical resolution is then linear in $M$ and can be done e.g. by dichotomy.
- This reminds of the knapsack optimization problem; where choosing objects that minimize the weight/value ratio is a good heuristics. However it is only an heuristics because each object can only be taken entirely or not at all, and the knapsack has a weight limit. Here however, by using integrals, we are in a perfect case, so the heuristics is optimal.
- If $\mathcal{A}$ is restricted to be an interval (my question in comments) $[c,d]$, the same kind of argument can probably be used to show that $\frac {f(c)} {g(c)} = \frac {f(d)} {g(d)}$ (assuming $f$ and $g$ continuous). The numerical resolution is then also linear in this value of $\frac {f(c)} {g(c)}$, although there can be a combinatorial explosion if the number of level sets for $\frac f g$ is high, or worse, infinite. So restricting $\mathcal{A}$ to be an interval is actually more difficult.