All submissions for this problem are available.
In each test cases, you are given two arrays P and Q, along with an integer k. Arrays will be of equal length (n). You can permute each array within itself so that in permuted version of P and Q, Pi+Qi >= k for each index i. You have to answer 'YES' or 'NO' according to whether such a permutation is possible or not. I/p format: N, followed by N testcases. Each test case is of following format. n k P1..Pn Q1..Qn o/p format: Each result (YES/NO) in a new line, and a newline character in the end Sample Input: 2 3 10 2 1 3 7 8 9 4 5 1 2 2 1 3 3 3 4 Sample Output: YES NO Reason: testcase 1: it is possible P: 3 2 1 Q: 7 8 9 testcase 2: Not possible
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.