Help In CHECHOC

Since there are no adjacent cells

not really corner but this
3 3 8 10

That’s for adjacent cells. Notice for n = 1 m = 1, there are no adjacent cells.

Here try this edge-case n=m=1.
eg. for test-case
1
1 1 1000 1
It is outputting 1, while answer should be 1000 as we do not have to worry about y in this case.
(Think why?!)

i tried explaing here the tricky test cases

(but went really fast)

https://www.codechef.com/viewsolution/35963081

try this 3 3 8 10

1 Like

some base conditions are required , like when x is greater than y then substitute y at every alternate places

see [CodeChef: Practical coding for everyone](http://My Soln) , covers all cases

Consider test case : 1 1 11 7
For this case, there are no adjacent cells in the 1x1 matrix. So, the cell can hold the value of x even if it exceeds ‘y’. This is the only corner case due to which many must have got WA.

1 Like

for 1X1 matrix output will be max value of X as there is no adjacent cell

lets say u take 3 3 8 10.
so, max u should get is: 4 X 2 + 5 X 8
i.e 48

This solution is giving WA. Am I missing any corner case?
FYI, I considered the corner case of 1x1 matrix.
https://www.codechef.com/viewsolution/36019255

sorry its giving correct for your solution, I was at mistake.

Yeah, I have missed the case for n=1 and m=1

Because it is only 1 element … since there are no adjacent to this… we need to print maximum X value …(our goal in problem was to find max. elements that can be filled)

CodeChef: Practical coding for everyone can someone help me with this

I think it must be 45. If not, please explain.

This submission gets ac : CodeChef: Practical coding for everyone
But This doesnt get ac: CodeChef: Practical coding for everyone

The question clearly says sum cant be greater than y, Then how is the second one not ac

The minimum of x and y should have gotten ac, if(x>y) then answer is y or else x, But Second link gives WA

it should be like this for 3 3 8 10
8 2 8
2 8 2
8 2 8
total is 48

1 Like

try the previous testcases everyone mentioned, like 3 3 8 10

https://www.codechef.com/viewsolution/35971993

Any test-cases for this one ?