The Resistance puzzle discussion

Uhm I guess it’s 1s like alot of puzzles. I’m on 100ms in C++ and I know a guy on 340ms in JavaScript.

Like Agade said, i got 340ms on the last one in JavaScript with a recursive method. Not really optimized. So i think you are fine even with an ugly algorithm.

vjau: Remember that the performance can differ in the validation messages. When I solved it, it was a matter of which data structure to use and how to use it which made all the difference.

I used DP using a trie as data store.

I guess i will have to learn about Dynamic Programming :wink:

Oh, it seems memoization is a type of dynamic programiing, so i was already doing dynamic programing without knowing it :wink:

2 Likes

Yes, it is.

Having overflow in long with the number of sequences…

Need to have some more tests, if anyone can provide them here, would be grateful.

Meanwhile will try to invent my own tests that probably will indicate the issues.

Can anyone provide example of “Many possibilities, with small sequence and small dictionnary”?

OK, I solved mine issues by looking into the code and inventing my own examples -
…----
4
E
EE
T
TT

answer here is 25


2
E
EEE
answer is 19

So if you’re stuck - just bring your code to your offline IDE, make it read input from file and experiment with your own examples.

8 Likes

Good work, making your own test cases is the way to go. It’s a pitty the Codingame IDE doesn’t let us create additional testcases.

It sounds like you changed the source code to read the input from a file? There is an even better way to do it. Just compile your program and start it from a terminal. There you can provide the input from a file with my-program < testcase1.txt. This way you are testing the exact same code you have online.

It’s possible to create custom test-case. :slight_smile:
=> コナミコマンド

1 Like

… but how?

Press the [?] key in the IDE (focus in the statement) to found out how ;).

1 Like

Please change the shortcut for that I press it by accident all the time!

Do you prefer iddqd?

1 Like

Why do you make that feature so inaccessible?

Ok, I should have read that waaaaaaaaaay before, that’s actually awesome

Good news! We are actively working on this feature, this should be available soon :). (not as a hidden feature this time)

I finally finished it, I should have known memorization was the key! :sunglasses:

I am though intrigued by what I read here about people that have solved it, I myself didn’t have to do any multiplication at all

Well, that’s awkward. I didn’t use memoization at all. :slight_smile: