Split Stones

All submissions for this problem are available.
Read problems statements in Hindi, Mandarin chinese , Russian and Vietnamese as well.
There are three piles of stones. The first pile contains $a$ stones, the second pile contains $b$ stones and the third pile contains $c$ stones. You must choose one of the piles and split the stones from it to the other two piles; specifically, if the chosen pile initially contained $s$ stones, you should choose an integer $k$ ($0 \le k \le s$), move $k$ stones from the chosen pile onto one of the remaining two piles and $sk$ stones onto the other remaining pile. Determine if it is possible for the two remaining piles (in any order) to contain $x$ stones and $y$ stones respectively after performing this action. ### Input  The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.  The first and only line of each test case contains five spaceseparated integers $a$, $b$, $c$, $x$ and $y$. ### Output For each test case, print a single line containing the string "YES" if it is possible to obtain piles of the given sizes or "NO" if it is impossible. ### Constraints  $1 \le T \le 100$  $1 \le a, b, c, x, y \le 10^9$ ### Subtasks **Subtask #1 (20 points):** $1 \le a, b, c, x, y \le 100$ **Subtask #2 (80 points):** original constraints ### Example Input ``` 4 1 2 3 2 4 3 2 5 6 5 2 4 2 6 2 6 5 2 12 1 ``` ### Example Output ``` YES NO YES NO ``` ### Explanation **Example case 1:** You can take the two stones on the second pile, put one of them on the first pile and the other one on the third pile. **Example case 2:** You do not have enough stones. **Example case 3:** You can choose the first pile and put all stones from it on the second pile.Author:  fekete 
Editorial  https://discuss.codechef.com/problems/SPLST 
Tags  cakewalk, fekete, fekete, likecs, ltime62 
Date Added:  25072018 
Time Limit:  0.5 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, 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, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 