All submissions for this problem are available.
Ram needs to transport cold-drink bottles. He takes a box and divides the box into AxB cells. In each cell he can place atmost one bottle. He then decides that he wants to put cushion around each bottle so now he will not be able to put two bottles adjacent to each other. He must just have placed the bottle in alternate fashion. But when he saw the box there were certain locations that were not suitable to put the bottles. He has a problem to know how many bottles can be accomodated into this box
1st Line gives number of the test cases
1st line of each test case gives number of bottles
2nd line gives values of A and B values
2nd line is followed by AxB matrix of 0s and 1s where 0 for unsuitable location and 1 for suitable location.
maximum number of bottle that can be accomodated into the box and no of ways it can be placed
Input: 2 3 2 2 01 11 4 3 4 1111 1001 1111 Output: 3 9 1 2
|Time Limit:||0.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, 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, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.