Sort 17 Discussions, By:
Please Login in order to post a comment
In example, all 4 are U (not even one is TT or D)...Then how in o/p you are showing T D and U
I think they are showing who got which part of the piece. Its all U, But D denotes Derpina got the U chocolate.
The sample test case is wrong for my understanding:
1 1 1
Answer as of test case:
Problem description states, to split chocolate in exactly TWO pieces.
To give Tom just 1 piece (all) and Derpina nothing is no split at all.
(nothing is not a piece)
Correct answer for my understanding:
Because it can't be split into "exactly TWO pieces"
What do You think?
Exactly my first thought
"The absolute difference between the number of chocolates in pieces should be at most K".
Which difference is being referred here? is it Absolute(numberOfChocolates(T) - numberOfChocolates(D)) ?
the statement probably should've said that you can't leave any piece of chocolate unattended, since the wording was a bit vague on whether you had to use all of it or not
Solved locall, but cannot upload code: Sorry, we can't accept your submission. Your submission size should not exceed 50 KB.
Reduced it to 45K by removing all comments (used to be 110K)... still cannot uoload... Grrr
Did it via DP, but there wasn't enough memory to do a full DP; could only memoize SOME steps. You know you're hacking when your code starts with
typedef unsigned int ulong;
It should be Derp and Derpina
Then all the chocolates would have been marked D and our program would get confused which D was for which Derp and which was for Derpina. XD
dude...stop trying m8. Not even funny bruh
Is it that you cannot have a 2X2 piece? Or any piece you cut shouldn't contain a piece that has a square?
For example -
test case -
3 3 4
So, is dividing the piece like
the statemant is: in any piece ,
therefore no, your example is not valid
in any piece
My C# algorithm times out for the three last cases.
Is there a way to avoid checking the global connectivity of both T (through T and U) and D (through D and U) each time I assign a U to either T or D?
If m=2, n=5:
is it valid or not?
you cant have 4 in a block so I guess no
Must have i/p k to determine how the diffence between two pieces is allow
and initial labed chocolate like
if you i/p has k=2 then some of the posible divition will be
TTDDD // yours