@@ -0,0 +1,1863 @@
+import java.io.*;%0Aimport java.math.*;%0Aimport java.security.*;%0Aimport java.text.*;%0Aimport java.util.*;%0Aimport java.util.concurrent.*;%0Aimport java.util.regex.*;%0A%0Apublic class Solution %7B%0A%0A    // Complete the twoArrays function below.%0A    static String twoArrays(int k, int%5B%5D A, int%5B%5D B) %7B%0A        Arrays.sort(A);%0A        Arrays.sort(B);%0A        for(int i=0;i%3CA.length;i++)%7B%0A            if(A%5Bi%5D+B%5BA.length-1-i%5D%3E=k)%7B%0A                continue;%0A            %7D%0A            else return %22NO%22;%0A        %7D%0A        return %22YES%22;%0A    %7D%0A%0A    private static final Scanner scanner = new Scanner(System.in);%0A%0A    public static void main(String%5B%5D args) throws IOException %7B%0A        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv(%22OUTPUT_PATH%22)));%0A%0A        int q = scanner.nextInt();%0A        scanner.skip(%22(%5Cr%5Cn%7C%5B%5Cn%5Cr%5Cu2028%5Cu2029%5Cu0085%5D)?%22);%0A%0A        for (int qItr = 0; qItr %3C q; qItr++) %7B%0A            String%5B%5D nk = scanner.nextLine().split(%22 %22);%0A%0A            int n = Integer.parseInt(nk%5B0%5D);%0A%0A            int k = Integer.parseInt(nk%5B1%5D);%0A%0A            int%5B%5D A = new int%5Bn%5D;%0A%0A            String%5B%5D AItems = scanner.nextLine().split(%22 %22);%0A            scanner.skip(%22(%5Cr%5Cn%7C%5B%5Cn%5Cr%5Cu2028%5Cu2029%5Cu0085%5D)?%22);%0A%0A            for (int i = 0; i %3C n; i++) %7B%0A                int AItem = Integer.parseInt(AItems%5Bi%5D);%0A                A%5Bi%5D = AItem;%0A            %7D%0A%0A            int%5B%5D B = new int%5Bn%5D;%0A%0A            String%5B%5D BItems = scanner.nextLine().split(%22 %22);%0A            scanner.skip(%22(%5Cr%5Cn%7C%5B%5Cn%5Cr%5Cu2028%5Cu2029%5Cu0085%5D)?%22);%0A%0A            for (int i = 0; i %3C n; i++) %7B%0A                int BItem = Integer.parseInt(BItems%5Bi%5D);%0A                B%5Bi%5D = BItem;%0A            %7D%0A%0A            String result = twoArrays(k, A, B);%0A%0A            bufferedWriter.write(result);%0A            bufferedWriter.newLine();%0A        %7D%0A%0A        bufferedWriter.close();%0A%0A        scanner.close();%0A    %7D%0A%7D%0A

add PermutingTwoArrays.java