ScienceGuy's blog

By ScienceGuy, history, 7 years ago, In English

Hi, I just began using Python 3.6.1 for Codeforces problems. Codeforces allows us to submit code in Python 3.5.2, so I wonder if my solutions in 3.6.1 might still get accepted. I solved this easy problem: http://codeforces.net/gym/101341/problem/M
Please, tell me what I'm doing wrong, here is my code (which runs well on my computer, but gets runtime error when I submit): https://pastebin.com/NPs7HbkK

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

| Write comment?
»
7 years ago, # |
Rev. 4   Vote: I like it 0 Vote: I do not like it
  1. Main problem is in your input. int(input()) reads line, but if you want to read multiple numbers in one line for Python 3.x you can use that:
v = [int(x) for x in input().split(' ')]

2. Again, don't use " " in Python, use ' ' instead.

Check AC submission here: http://codeforces.net/gym/101341/submission/28311885

UPD: seems you can't see submission until you didn't solve it, here is pastebin link: https://pastebin.com/Lf2NbKnw

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

    Why not use " "?

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

      Actually, I don't know, but it gives Runtime Error sometimes..