매일코테

백준 10단계 no.3

공주맛밤 2022. 7. 26. 15:46

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        sc.nextLine();
        int[][] arr = new int[n][2];

        for (int i = 0; i < arr.length; i++) {
            String info = sc.nextLine();
            String[] arrInfo = info.split(" ");

            arr[i][0] = Integer.parseInt(arrInfo[0]);
            arr[i][1] = Integer.parseInt(arrInfo[1]);
        }

        for (int j = 0; j < arr.length; j++) {
            int count = 1;
            for (int k = 0; k < arr.length; k++) {
                if (arr[j][0] < arr[k][0] && arr[j][1] < arr[k][1]) {
                    count++;
                }
            }
            System.out.print(count + " ");
        }
    }
}
728x90
반응형

'매일코테' 카테고리의 다른 글

백준 11단계 no.2  (0) 2022.07.27
백준 11단계 no.1  (0) 2022.07.27
백준 10단계 no.1  (0) 2022.07.26
백준 9단계 no.5  (0) 2022.07.26
백준 9단계 no.3  (0) 2022.07.25