Source: https://adrien.poupa.fr/efrei/Optimisation et complexité/matrices-maxima.pdf