c++ solution for max area problem