-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBAEKJOON_11650
More file actions
61 lines (50 loc) · 1.44 KB
/
BAEKJOON_11650
File metadata and controls
61 lines (50 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import java.io.*;
import java.util.*;
public class Main {
private int x;
private int y;
public Main(int x, int y){
this.x = x;
this.y = y;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public static void main(String[] args) throws IOException {
BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw =new BufferedWriter(new OutputStreamWriter(System.out));
int test_case = Integer.parseInt(br.readLine());
List<Main> list = new ArrayList<>();
for(int i=0; i<test_case; i++){
StringTokenizer st = new StringTokenizer(br.readLine());
int a = Integer.parseInt(st.nextToken());
int b = Integer.parseInt(st.nextToken());
list.add(new Main(a,b));
}
Collections.sort(list,new Comparator<Main>(){
@Override
public int compare(Main m1, Main m2){
if(m1.x > m2.x){
return 1;
}else if(m1.x == m2.x){
if(m1.y > m2.y){
return 1;
}
}
return -1;
}
});
for(Main m : list){
System.out.println(m.x+" "+m.y);
}
}
}