CHECHOC - Editorial

Exactly my thoughts. For the corner 1x1 case, shouldn’t we output min(x, y)? I got WA solely due to this reason.

3 Likes

Hi All,

Any hint on what I’m missing

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

Can someone tell me for case 3 3 20 19 how the ans=95?

Can anyone tell me the case when my solution wont work?
https://www.codechef.com/viewsolution/36013917

1
1 1 6 4
you code gives output 4 but it should be 6, as answer for 1by1 matrix will be x always

1 Like

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

link to submission.
any help will be appreciated .

3*3 = 9 cells total , out of these 9 one can fill max of X(20) in each cell but as per condition - two adjacent cells can only have max value which would be equal to Y(19).
so we can fill 9/2+1 cells as 19 which is max and hence maintain the condition of adjacent pairs to be equal to 19.

1 Like

I saved a lot of time because of your comment. Thanks

put 19 candies in both diagonals of matrix and zero candies in rest

In the case of 1*1 matrix, there are no adjacent pairs, so the answer should be x not min(x,y).

1 Like

1
1 1 6 4
output-6

Suppose I take max = x and min = y - x and say the matrix is 4X3
Then I can arrange it like :
max min max
min max min
max min max
min max min

Any adjacent pair will always have sum = x + (y-x) = y
What is wrong with this approach?

1 Like

Oh, I was thinking that even if there’s just one cell, it has to follow the condition of sum being less than y. Thanks a lot!

1 Like

try 1 1 4 1 answer will be 4 not 1

1 Like

AC after more than 10 tries ^^’ here

can someone tell me .Whats wrong with my code? @cherry0697 @younoknowme
https://www.codechef.com/viewsolution/36010742

OMG cant believe that is cost me 100 :cry:

I got it now - was printing min of x and y in case of n * m = 1.

can we see the test case on which our solution failed?

19 0 19
0 19 0
19 0 19
ans = 95

2 Likes