-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path7568.java
More file actions
43 lines (35 loc) · 740 Bytes
/
7568.java
File metadata and controls
43 lines (35 loc) · 740 Bytes
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
import java.util.Scanner;
public class Main{
void Grade(int N,int[][] arr) {
int grade[]= new int[N];
int x,y,p,q;
for(int i=0; i<N; i++)
grade[i]=1;
for(int i=0; i<N; i++) {
x=arr[i][0];
y=arr[i][1];
for(int j=0; j<N; j++) {
if(i!=j) {
p=arr[j][0];
q=arr[j][1];
if(x<p && y<q)
grade[i]++;
}
}
}
for(int i=0; i<N; i++)
System.out.print(grade[i]+" ");
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Main Main = new Main();
int N = scanner.nextInt();
int[][] arr=new int[N][2];
for(int i=0; i<N; i++) {
arr[i][0]=scanner.nextInt();
arr[i][1]=scanner.nextInt();
}
Main.Grade(N,arr);
scanner.close();
}
}