1
//
1100 C++ Accepted 0.171 1 893 KB URAL
2
3
4 #include < stdio.h >
5 #include < stdlib.h >
6 #include < string .h >
7
8 struct NODE
9 {
10 int num ;
11 int x ;
12 int y ;
13 };
14 struct NODE node[ 150010 ] ;
15
16 int inn ;
17
18 int cmp( const void * a, const void * b )
19 {
20 struct NODE * c = ( struct NODE * )a ;
21 struct NODE * d = ( struct NODE * )b ;
22
23 if ( c -> y != d -> y ) return d -> y - c -> y ;
24 else return c -> num - d -> num ;
25 }
26
27 int main()
28 {
29 while ( scanf( " %d " , & inn ) != EOF )
30 {
31 for ( int i = 1 ; i <= inn; i ++ )
32 {
33 scanf( " %d %d " , & node[i].x, & node[i].y ) ;
34 node[i].num = i ;
35 }
36
37 qsort( node + 1 , inn, sizeof (node[ 1 ]), cmp ) ;
38
39 for ( int i = 1 ; i <= inn; i ++ )
40 printf( " %d %d\n " , node[i].x, node[i].y ) ;
41 }
42
43 return 0 ;
44 }
2
3
4 #include < stdio.h >
5 #include < stdlib.h >
6 #include < string .h >
7
8 struct NODE
9 {
10 int num ;
11 int x ;
12 int y ;
13 };
14 struct NODE node[ 150010 ] ;
15
16 int inn ;
17
18 int cmp( const void * a, const void * b )
19 {
20 struct NODE * c = ( struct NODE * )a ;
21 struct NODE * d = ( struct NODE * )b ;
22
23 if ( c -> y != d -> y ) return d -> y - c -> y ;
24 else return c -> num - d -> num ;
25 }
26
27 int main()
28 {
29 while ( scanf( " %d " , & inn ) != EOF )
30 {
31 for ( int i = 1 ; i <= inn; i ++ )
32 {
33 scanf( " %d %d " , & node[i].x, & node[i].y ) ;
34 node[i].num = i ;
35 }
36
37 qsort( node + 1 , inn, sizeof (node[ 1 ]), cmp ) ;
38
39 for ( int i = 1 ; i <= inn; i ++ )
40 printf( " %d %d\n " , node[i].x, node[i].y ) ;
41 }
42
43 return 0 ;
44 }