can someone pl give a test case where my code fails??
http://www.codechef.com/viewsolution/7018861
can someone give me a test input where my code is failing…
CodeChef: Practical coding for everyone This is my solution which got time limit exceeded.Can anyone help me with this?I think time complexity is O(n).
plzz tell me how is that possible… range of t is t<10^5 , so the data type of t should be long int, but in the following solution it is solved with “int” only…??
http://www.codechef.com/viewsolution/7017858
I have been getting a wrong answer for my code.
http://www.codechef.com/viewsolution/7019853
I would be glad if someone could give me a test case for which this fails.
Here’s what i did. I implemented a Heap whose where the first 2 highest values are constantly updated. This is essentially a greedy approach since i take the 2 largest. So if it were aaabbc. It would take a nd b whose occurences are 3 and 2. It would reduce them to 2 and 1 respectively and append the character to a string. Now the heap essentially consists of a(2) b(1) c(1). Now remove a and b and repeat. Now you have a(1),c(1). Append and done. Also, be careful when the size of the heap is 1. E.i only one character is left. You can add it only if the number of occurences of that character are 1 and the previuos value appended is not equal to this one.
can any one tell where i did wrong…
i am getting runtime error(nzec) but it is working good in my system for all cases…
CodeChef: Practical coding for everyonelink text
@va1ts7_100 i hope you are confused. By the way range of int is –2,147,483,648 to 2,147,483,647 .
@hello_all Your code is runing fine. here is the linklink text i don’t see why it was giving tle.
Anyways u can place your strlen() out of for loop because in every iteration it will be called.
can i know the cases where my code fails.have been getting wrong answer even though i have tried a similar approach. here is my sol link text
Getting wrong answer but not sure why …Can anyone point out failing test case please
http://www.codechef.com/viewsolution/7021382
Help is appreciated !!