317. Shortest Distance from All Buildings (Hard)