Assume that $ \lambda $ is the Lebesgue measure on $ \mathbb{R}^N,\ N \geq 1. $ Let $ f \in L^1_\text{loc}( \mathbb{R}^N, d \lambda),\ f \geq 0. $ Assume that there exists $ \alpha > 0 $ such that, for all Borel set $ E $ of $ \mathbb{R}^N $ with $ \lambda(E) = \alpha, $ then $ \int_E f \, d \lambda = \alpha. $
The question is : prove that $ f = 1 \text{ a.e.} $
Any idea? (I have the idea to set $ D = \{x , f(x) < 1\} $ and to prove by contradiction that $ \lambda (D) = 0 $ and later the set $ D' = \{x , f(x) > 1\} $)
Your idea looks good to me. Both $D$ and $D'$ have to have measure less than $\alpha$, otherwise we could integrate over a subset of one with measure $\alpha$ and we'd be in trouble.
However, since both have measure less than $\alpha$, we can find Borel sets $E$ and $E'$ that are disjoint from both with $\lambda(E \cup D) = \alpha = \lambda(E' \cup D')$. Integrating over $E \cup D$ and $E' \cup D'$ is going to cause problems unless $D$ and $D'$ have measure $0$.