import java.io.*;
import java.util.*;
class Point{
int x;
int y;
public Point( int x, int y ){
this.x = x;
this.y = y;
}
public void print(){
System.out.println( "" + x + " " + y );
}
}
public class Main{
public static void main( String [] args )throws Exception{
Scanner cin = new Scanner( System.in );
int n = cin.nextInt();
PriorityQueue queue = new PriorityQueue<Point>( 1, new Comparator<Point>(){
public int compare( Point a, Point b ){
if( a.x < b.x || a.x == b.x && a.y < b.y ){
return -1;
}
else if( a.x == b.x && a.y == b.y ){
return 0;
}
else{
return 1;
}
}
});
for( int i = 0; i < n; i++ ){
int x = cin.nextInt();
int y = cin.nextInt();
Point p = new Point( x, y );
queue.add( p );
}
while( queue.size() > 0 ){
Point p = ( Point )queue.poll();
p.print();
}
}
}
posted on 2009-08-22 21:53
Huicpc217 阅读(681)
评论(0) 编辑 收藏 引用 所属分类:
JAVA 、
模板