In this article, the inverse problems for the wave equation in a medium in which multiple types of cavities and inclusion exist in a mixture are considered. From the point of view of the indicator function of the enclosure method, there are two types of heterogeneous parts: “minus group” and “plus group.” For example, cavities with the Dirichlet boundary condition belong to the minus group, while inclusions with smaller propagation velocity belong to the plus group. The heterogeneous part of the minus group gives a negative sign to the indicator function, and the heterogeneous part of the plus group gives a positive sign. In general, the presence of many types of heterogeneous parts causes cancelation of the sign of the indicator function. Such cases are referred to as “mixed cases.” Here, we consider the case that the shortest length obtained from the indicator function is attained only by heterogeneous parts of the same group. This case is called the “mixed but separated case,” and it is shown that the method of elliptic estimates developed by Ikehata works well. We also show that the case of a two‐layered background medium with a flat layer can be considered in the same way as the case of a homogeneous background medium.