the shortest path spoj solution