add c++ version solution, store the points in map.