Step 1, for me, would be to write a brute force solver. Step 2 would be to use that, look at cases, and try and spot patterns. My Maths instincts tell me the answer is probably always going to be nm, nm-1 or nm-2 depending on parity. I would use my brute forces to verify and/or correct that and try and work out how to build such a path.
On 24 May 2012, at 07:26, Registered user <[email protected]> wrote: > well i have applied similar logic in the below link , check dis plz , and > whats the complexity for this : > > http://ideone.com/oamwJ > > > or u plz tell me how to solve the above problem statement > > On Thu, May 24, 2012 at 11:43 AM, Prasoon Kumar <[email protected]> wrote: > You can not simply blame to java. As per my understanding your logic > complexity is 5^n. It will give trouble in any language. > > > On Thu, May 24, 2012 at 11:31 AM, Registered user <[email protected]> > wrote: > why it is that sometimes java just gives up.... > > the problem statement is here : > http://www.codeforces.com/contest/111/problem/E > > my solution at the below link : > atleast when the loop finishes it must termininate but what the hell is in > the below link code ,,, > > it works for small matrix upto 6x6 but 7x7 and above it just dies out > without any response. > > logically i didnt find any error . > > also if there may be any logical error then the result would be error.or the > loop would terminate. but it seems to have gone under infinite loop. > > but i havent modified the loop's iterator value at any place so the loop must > terminate at some point but it never happens..... > > Plz hv a look and test it with 6x6 ( the output comes for this) > > > and test it with 7x7 or higher matrix ( its running and running dat never > ends.. :( ) > > > http://ideone.com/K19Zg > -- > You received this message because you are subscribed to the Google Groups > "Google Code Jam" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-code?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Google Code Jam" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-code?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Google Code Jam" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-code?hl=en. -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-code?hl=en.
