NOxBODY's blog

By NOxBODY, 8 months ago, In English

Hello Brilliant People!

I'm trying to be fluent in Python. In that regard, I am using this as the first language for my practice in CodeForces. My solution failed with a run-time error at test case # 12, however, it had passed prior cases having similar inputs. To check if there was a loophole in my logic for the solution, I wrote it in C++, and the submission got accepted. Is there a difference between the recursive stack behaviors of C++ and Python? I guessed PyPy 3-64 wasn't allowing as many recursions as C++ does. So, I changed my recursive approach into a classic stack-based DFS approach, and then the solution in Python was accepted.

Am I thinking correctly? What things should I know regarding this?

Thanks. Happy problem-solving!

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By NOxBODY, history, 4 years ago, In English

Hello Everyone!

I want to describe 2 problems I have found so far.

1. End Of Line

I was trying to write a solution in JavaScript V8 and test it in the Custom Invocation section before submitting. Unfortunately I was getting "TypeError" on invocation of string methods for the string returned by readline().

I submitted the same code later and got "Accepted"!

Reason

For readline() to work successfully the input line must end with a new line('\n'). When I was manually selecting and copying example input text from the problem statement page, it was not being copied with the ending new line. But, when I copied the same input by clicking the "Copy" button at the right side of the example input box, it was copied with the ending new line character.

Good Practice

If input is manually selected and copied, or typed in the Custom Invocation input box by using keyboard, a new line at the end of the input line can make readline() work perfectly.

2. Trailing Backslash

If there is a backslash('\\') at the end of line, then JavaScript V8 readline() returns undefined. I have not found anything to overcome this problem yet. Any help will highly appreciated.

Thank you very much for reading.

Full text and comments »

  • Vote: I like it
  • +2
  • Vote: I do not like it