⭐문제 : https://www.acmicpc.net/problem/7568
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
int[] rank;
int [] weight;
int [] height;
int N = Integer.parseInt(br.readLine());
weight = new int[N];
height = new int[N];
rank = new int[N];
for(int i=0; i<N; i++){
st = new StringTokenizer(br.readLine(), " ");
weight[i] = Integer.parseInt(st.nextToken());
height[i] = Integer.parseInt(st.nextToken());
}
for(int i=0;i<N;i++){
int cnt = 1;
for(int j=0;j<N;j++){
if(i==j) continue;
if(weight[i] < weight[j] && height[i]<height[j]) {
cnt++;
}
}
rank[i] = cnt;
}
for(int answer : rank){
System.out.print(answer+" ");
}
}
}