All submissions for this problem are available.
A Boy asks out a Girl for a date. The Girl told the Boy to get roses for her at that instant. She wants N different kinds of roses but only one of each type. Each rose have several layers of petals. The number of petals in each layer goes on decreasing from outside to inside. Now, the girl will count every petal of all the roses and if total petals of all the roses are odd then she will go with him otherwise she won’t. Help girl to make decision.
First line of input contains a number N total number of test cases.
First line of each test case will contain a number specifying types of roses T.
Each of the following T lines will contain two numbers. First number is difference D and second number is number of petals O in outermost layer.
YES if she goes on date and NO if she does not.
- 1 ≤ N ≤ 20
- 1 ≤ T ≤ 1000
- 1 ≤ D ≤ O
- 1 ≤ O ≤ 1000^5
Input: 2 2 1 9 3 8 4 2 4 3 9 1 9 2 7
Two is the number of test cases.For First Input there are 2 Types of roses 1st Rose has 9 petals at outermost layer and 1 is the difference of petals from outer to inner side and second has 8 petals at outermost layer and 3 is the difference.For second Input there are 4 types of roses and the difference and number of petals of the outer most layer is given for each type of rose respectively.The sum for First 2type does not satisfy the condition of the girl hence output is NO,while the second does hence output is YES.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, PIKE, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, JS, ERL, PERL6, CLOJ, FS|
Fetching successful submissions