@@ -0,0 +1,637 @@
+import java.util.Arrays;%0Aimport java.util.Scanner;%0A%0Apublic class SocialCircles %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A        Scanner scanner = new Scanner(System.in);%0A        int n = scanner.nextInt();%0A        int%5B%5D left = new int%5Bn%5D;%0A        int%5B%5D right = new int%5Bn%5D;%0A        for (int j = 0; j %3C n; j++) %7B%0A            left%5Bj%5D = scanner.nextInt();%0A            right%5Bj%5D = scanner.nextInt();%0A        %7D%0A        Arrays.sort(left);%0A        Arrays.sort(right);%0A        long answer = 0;%0A        for (int i = 0; i %3C n; i++) %7B%0A            answer += Math.max(left%5Bi%5D, right%5Bi%5D) + 1;%0A        %7D%0A        System.out.println(answer);%0A    %7D%0A%7D%0A

Add SocialCircles