Here is the question.
Let $f$, $g$ be locally integrable functions on $\mathbb{R}^n$ such that$$\inf_{a \in \mathbb{R}} \int_{B} |f(x) - a|\ dx \leqslant \int_B|g(x)|\ dx$$for all balls $B$ in $\mathbb{R}^n$. Show that there exists a constant $c$ such that$$\int_{\mathbb{R}^n} |f(x) - c|\ dx \leqslant \int_{\mathbb{R}^n}|g(x)|\ dx.$$
We only need to consider the case where $g$ is integrable. For now I can prove that the infimum for each ball can be really reached in $\mathbb{R}$ instead of obtained by a sequence tending to infinity.
Then we denote $B_{n} = B(0, n)$, and suppose $a_n$ satisfies that$$\int_{B_{n}} |f(x) - a_n|\ dx \leqslant \int_{B_{n}}|g(x)|\ dx.$$
There are two cases to consider. The first one is simple, that is the sequence ${a_n}$ has at least one convergent subsequence with the limit $a_0$. Then by Fatou's Lemma we have\begin{align}\int_{\mathbb{R}^n}|g(x)|\ dx &\geqslant \liminf_{n \rightarrow \infty} \int_{B_{n}} |f(x) - a_n|\ dx \\&= \liminf_{n \rightarrow \infty} \int_{\mathbb{R}^n} |f(x) - a_n| \chi_{B_{n}}(x) \ dx\\& \geqslant \int_{\mathbb{R}^n} \liminf_{n \rightarrow \infty} |f(x) - a_n| \chi_{B_{n}}(x)\ dx\\& = \int_{\mathbb{R}^n} |f(x) - a_0|\ dx.\end{align}
My question is how to deal with the case where the sequence does not contain any convergent subsequence, i.e. $|a_n| \rightarrow \infty$.
After some thinking, I have some ideas but can not work out for practice. For example, maybe it has something to do with the Vitali covering Thm, or maybe if the sequence is diverging, then there should be something wrong which means we need to prove the sequence must have a convergent subsequence.
So could someone help me with the problem?