starkizard's blog

By starkizard, history, 5 years ago, In English

In round #643 Div 2 , for question B, I did this solution using PyPy 3: https://codeforces.me/contest/1355/submission/80386227

it passed the protests but TLE'd test case #26 after system testing I did the same code in CPP , and it ran flawlessly: https://codeforces.me/contest/1355/submission/80387439

Is there any tip for me, who codes in python. relatively new to cpp. Should there be time extension for python as in other platforms? or is there something I can do to my code to make it faster?

  • Vote: I like it
  • -25
  • Vote: I do not like it

| Write comment?
»
5 years ago, # |
  Vote: I like it +4 Vote: I do not like it

Use fast input: 80394049.

See this or this.

  • »
    »
    5 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thank You so much! okay so using : import sys input = sys.stdin.readline solves it, and would support in future cases too right? I didn't quite get how to incorporate the links you mentioned in python3. Can you help with this? Thank you so much!

    • »
      »
      »
      5 years ago, # ^ |
        Vote: I like it +4 Vote: I do not like it

      input = sys.stdin.readline is a minimal way to speed up input. If you use this keep in mind that stdin.readline keeps the trailing newline unlike input.

      The other links are for faster input/output that you can use when needed, or if you use a template you just add it there.