New knowledge~ 1.map不能sort,但是把map里面存的数据复制到vector的pair类型中,就可以完美解决map排序问题。详细见图。 (其中p为 pair<int,int> 的 typedef ,r1 ,c1 是定义的变量名) attention! sort vector时,里面是XXX.begin() XXX.end()的形式。