Re: [gcj] Saving the universe again - Why my code failed in the test set 2?

2020-03-23 Thread porker2008
You have two bugs in your code *for j in range(n-1, -1, -1):* should be *for j in range(n-1, 0, -1):* This is to make sure that j-1 is not negative. The other bug is for finding the right pair of CS to swap. Use the following as example: CCSS The first pair you swap is C*CS*S, then it

Re: [gcj] Saving the universe again - Why my code failed in the test set 2?

2020-03-23 Thread Sourakanti Mandal
https://github.com/Sonu64/saving_the_universe_again/ Check out the code in my GitHub Repo please :) -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: [gcj] Saving the universe again - Why my code failed in the test set 2?

2020-03-23 Thread Sourakanti Mandal
Sorry for pasting all the code herebut though have a look.. def isCapable(s, able): #finds if a beam is capable of withstanding "able" charge = 1 damage = 0 for step in s: if step == "S": damage += charge if step == "C": charge *= 2

Re: [gcj] Saving the universe again - Why my code failed in the test set 2?

2020-03-22 Thread porker2008
Can you share your code? -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-code+unsubscr...@googlegroups.com. To view this discussion on the web visit

Re: [gcj] Saving the universe again - Why my code failed in the test set 2?

2020-03-22 Thread Sourakanti Mandal
Hello...Now I am swapping CS pairs from right to left, so that 6 CSSCS ouputs 1 now. But though it Fails in the 2nd Test Set. What's the problem ? I am really stuck at this ! :( -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To

Re: [gcj] Saving the universe again - Why my code failed in the test set 2?

2018-04-12 Thread Javier Martin
Because you should consider flips from right to the left. Consider this test case: 6 CSSCS Your program outputs 2, should be 1. On Mon, Apr 9, 2018 at 9:16 PM, aagontuk wrote: > Hello, I have participated in the codejam for the first time. My solution > for the problem

[gcj] Saving the universe again - Why my code failed in the test set 2?

2018-04-11 Thread aagontuk
Hello, I have participated in the codejam for the first time. My solution for the problem passed for test set 1 but failed for test set 2. But from the analysis it seems correct to me. Why it failed? Here is my code - https://gist.github.com/aagontuk/e5f4e7f30b2481d96a418882f8a2fa7e I don't