  According to planetary interior models, some giant planets contain large
metal masses with large metal-mass fractions. HD 149026b and TOI-849b are
characteristic examples of these giant planets. It has been suggested that the
envelope mass loss during giant impacts plays a key role in the formation of
such giant planets. The aim of the present letter is to propose a mechanism
that can explain the origin of such giant planets. We investigate the formation
of giant planets in a rapidly dissipating disk using N-body simulations that
consider pebble accretion. The results show that although the pebble isolation
mass is smaller than the metal mass (> 30 Earth masses) in some giant planets,
the interior metal mass can be increased by giant impacts between planets with
the isolation mass. Regarding the metal fraction, the cores accrete massive
envelopes by runaway gas accretion during the disk-dissipation phase of 1-10
Myr in a disk that evolves without photoevaporation. Although a large fraction
of the envelope can be lost during giant impacts, the planets can reaccrete the
envelope after impacts in a slowly dissipating disk. Here, we demonstrate that,
by photoevaporation in a rapidly dissipating disk, the runaway gas accretion is
quenched in the middle, resulting in the formation of giant planets with large
metal-mass fractions. The origins of HD 149026b and TOI-849b, which are
characterized by their large metal-mass fractions, can be naturally explained
by a model that considers a disk evolving with photoevaporation.
