Context.In the last few years, the so-called Nice model has become increasingly significant for studying the formation and evolution of the solar system. According to this model, the initial orbital configuration of the giant planets was much more compact than the one we observe today. Aims.We study the formation of the giant planets in connection with several parameters that describe the protoplanetary disk.We aim to establish which conditions enable their simultaneous formation in line with the initial configuration proposed by the Nice model. We focus on the conditions that lead to the simultaneous formation of two massive cores, corresponding to Jupiter and Saturn, which are able to reach the cross-over mass (where the mass of the envelope of the giant planet equals the mass of the core, and gaseous runway starts), while two other cores that correspond to Uranus and Neptune have to be able to grow to their current masses. Methods.We compute the in situ planetary formation, employing the numerical code introduced in our previous work for different density profiles of the protoplanetary disk. Planetesimal migration is taken into account and planetesimals are considered to follow a size distribution between rmin p (free parameter) and rmax p = 100 km. The core;s growth is computed according to the oligarchic growth regime. Results. The simultaneous formation of the giant planets was successfully completed for several initial conditions of the disk. We find that for protoplanetary disks characterized by a power law (r.p), flat surface density profiles (p . 1.5) favor the simultaneous formation. However, for steep slopes (p . 2, as previously proposed by other authors) the simultaneous formation of the solar system giant planets is unlikely. Conclusions. The simultaneous formation of the giant planets . in the context of the Nice model . is favored by flat surface density profiles. The formation time-scale agrees with the estimates of disk lifetimes if a significant mass of the solids accreted by the planets is contained in planetesimals with radii <1 km.