Cyanopolyynes are chains of carbon atoms with an atom of hydrogen and a CN group on either side. They are detected almost everywhere in the ISM, as well as in comets. In the past, they have been used to constrain the age of some molecular clouds, since their abundance is predicted to be a strong function of time. We present an extensive study of the cyanopolyynes distribution in the solar-type protostar IRAS16293-2422 based on TIMASSS IRAM-30m observations. The goals are (i) to obtain a census of the cyanopolyynes in this source and of their isotopologues; (ii) to derive how their abundance varies across the protostar envelope; and (iii) to obtain constraints on the history of IRAS16293-2422. We detect several lines from HC3N and HC5N, and report the first detection of DC3N, in a solar-type protostar. We found that the HC3N abundance is roughly constant (~1.3x10^(-11)) in the outer cold envelope of IRAS16293-2422, and it increases by about a factor 100 in the inner region where Tdust>80K. The HC5N has an abundance similar to HC3N in the outer envelope and about a factor of ten lower in the inner region. The HC3N abundance derived in the inner region, and where the increase occurs, also provide strong constraints on the time taken for the dust to warm up to 80K, which has to be shorter than ~10^3-10^4yr. Finally, the cyanoacetylene deuteration is about 50% in the outer envelope and <5$% in the warm inner region. The relatively low deuteration in the warm region suggests that we are witnessing a fossil of the HC3N abundantly formed in the tenuous phase of the pre-collapse and then frozen into the grain mantles at a later phase. The accurate analysis of the cyanopolyynes in IRAS16293-2422 unveils an important part of its past story. It tells us that IRAS16293-2422 underwent a relatively fast (<10^5yr) collapse and a very fast (<10^3-10^4yr) warming up of the cold material to 80K.