We investigated the magnetic structure of an orthorhombic YMnO3 thin film by resonant soft x-ray and hard x-ray diffraction. We observed a temperature-dependent incommensurate magnetic reflection below 45 K and a commensurate lattice-distortion reflection below 35 K. These results demonstrate that the ground state is composed of coexisting E-type and cycloidal states. Their different ordering temperatures clarify the origin of the large polarization to be caused by the E-type antiferromagnetic states in the orthorhombic YMnO3 thin film.