A measurement of the lifetimes of the Ω0c and Ξ0c baryons is reported using proton-proton collision data at a centre-of-mass energy of 13 TeV,corresponding to an integrated luminosity of 5.4 fb-1 collected by the LHCb experiment.The Ω0c and Ξ0c baryons are produced directly from proton interactions and recon-structed in the pK-K-π+ final state.The Ωc0 lifetime is measured to be 276.5 ± 13.4 ± 4.4 ± 0.7 fs,and theΞ0c lifetime is measured to be 148.0 ± 2.3 ± 2.2 ± 0.2 fs,where the first uncertainty is statistical,the sec-ond systematic,and the third due to the uncertainty on the D0 lifetime.These results confirm previous LHCb measurements based on semileptonic beauty-hadron decays,which disagree with earlier results of a four times shorter Ωc0 lifetime,and provide the single most precise measurement of the Ωc0 lifetime.