i don't know why m getting WA...although i checked for various test cases from forums too..
don't panic from lenght of code..half of it is used to create heap....
[color=#FF0000]plz provide some test cases where the code fails....
thanks in advance...[/color]