High-mass prestellar cores are extremely rare. Until recently, the search for such objects has been hampered by small sample sizes, leading to large ambiguities in their lifetimes and hence the conditions in the cores in which high-mass stars (>8M_{sun}) form. Here we leverage the large sample (~580 cores) detected in the ALMA-IMF survey to identify both protostellar and prestellar cores to estimate their relative lifetimes. We used CO and SiO outflows to identify protostellar cores. We present a new automated method based on aperture line emission and background subtraction to systematically detect outflows associated with each of the 141 most massive cores. Massive cores that are not driving an outflow in either tracer are identified as prestellar. After careful scrutiny of the sample, we derived statistical lifetime estimates for the prestellar phase. Our automated method allows the efficient detection of CO and SiO outflows and has a performance efficiency similar to that of more cumbersome classical techniques. We identified 30 likely prestellar cores with M>8M{sun}, of which 12 have core masses M>16M{sun}. The latter group contains the best candidates for high-mass star precursors. Moreover, most of these 12 high-mass prestellar cores are located inside the crowded central regions of the protoclusters, where most high-mass stars are expected to form. Using the relative ratios of prestellar to protostellar cores, and assuming a high-mass protostellar lifetime of 300kyr, we derive a prestellar core lifetime of 120kyr to 240kyr for cores with masses 8M{sun}_