maulik12's blog

By maulik12, history, 9 years ago, In English

I recently encountered this question from one of my friends. You are given an chocolate bar of size M*N. Also you are given an array of pieces to be cut. Example: If M- 3 and N = 4, the array that is given is : 1,2,3 and 6

We can divide the chocolate into such rectangular pieces of these sizes. Note that the sizes have to be rectangular.

Can we do this just by checking the sum and then see if the following constraints are satisfied:

  1. I am using just a verification that if the size to be cut(K) is odd, then the value of M or N has to be greater than or equal to K, then only we can cut it into (1 X K) or (K X 1).

I do not get whether this is an advanced problem or just some ad hoc problem. Please advice on how to solve the question and ask any queries.

Full text and comments »

  • Vote: I like it
  • -4
  • Vote: I do not like it

By maulik12, 9 years ago, In English

I was trying to find some good questions involving Stack and which are not DFS type questions. The list of questions are as follows: http://www.spoj.com/problems/JNEXT/
STPAR
ONP
Compiler
Molecular Mass

It would be really helpful if you could also add some problems on Stack.

Thank you for your response, Maulik

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By maulik12, 9 years ago, In English

Hi Everyone, I have been practicing Segment trees and there's a very straightforward problem on SPOJ. Link:http://www.spoj.com/problems/CDC12_H/

I have used Lazy Propagation by I am getting WA. And I don't know why. Here's my code. Link: http://ideone.com/gAx34B

Its pretty much understandable. Please tell me as to where I am wrong . Thanks, Maulik

Full text and comments »

  • Vote: I like it
  • +10
  • Vote: I do not like it