Source: https://www.epfl.ch/labs/lcso/wp-content/uploads/2020/10/Exercices2019.pdf