A characterization of heaviness in terms of relative symplectic cohomology