* using GetInt() to replace scanf("%d") to improve the performance
* recording the minimum path during the building process