Hybrid control for optimal visiting problems for a single player and for a crowd