SarveshDubey's blog

By SarveshDubey, history, 5 years ago, In English

Having been on Codeforces for last 5 months, it feels great to have some very helpful people and feels awesome to be a part of such active community. I have been doing CP for last 5 months constantly and practice daily but quite oftenly a query disturbs me is that should I be using Python for CP.. I have been doing quite a lot of python since I started off with cp and have been comfortable with it.. But due to the C++ popularity in cp I tried C++ too for around 1 month and realized that during that time interval I was more of thinking of things to use for language rather than the main crux or logic of the question... Now my question to all of my friends is that should one use python for CP if he is comfortable with it and want to think more of logic to the question rather than being involved in the language and searching how can be something implemented...

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

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

How much did you practice during that 1 month? To me it seems that if you actively use a language for a month, you should be quite fluent (for competitive programming purposes).

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

    The problem is I find python more comfortable and thus always when I find myself in trouble with C++ I switch myself to Python and solve problem in python...

    • »
      »
      »
      5 years ago, # ^ |
      Rev. 2   Vote: I like it +8 Vote: I do not like it

      It sounds like your main problem is that you switch when in trouble. That's not the way to learn.

      1 month only c++ in cp should get you set. This is coming from someone who started sports programming with C++ even though I never wrote a line of c++ beforehand (I used python, lua)

»
5 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

I was also a Python user when I started competitive programming in June this year. However, I forced myself to use C++ for everything even though I was quite uncomfortable with it then. I dropped to newbie through the painful transition, but I think it was worth it since C++ is much more robust and so it's better suited for competitive programming. And obviously, you can tell I have improved since then. You need to fully commit to using C++, only then will you eventually get used to it.

One thing I suggest is solving a lot of div2A in C++, so you can focus on getting used to the language rather than the (simple) logic of the problem.

»
5 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

As for me, Python is extremely more comfortable language than C++.

Main downside of Python is it's execution time. Usually it is not trivial task to get Python solution with O(N·logN) complexity accepted, when N is up to 105. Of course you may try using PyPy and custom input/output function, custom casting functions, but still this will not guarantee you anything.

In my case, this was the main reason to switch from Python and Ruby to C++. But I still prefer to use Python when I understand that solution does not require high execution speed.

I really doubt that one should consider language popularity as a meaningful parameter to use or not to use some language. Yes, language popularity provides some additional benefits: language is supported on more platforms and more competitions, more people understand this language (higher probability that your teammates will already understand this language, if you are competing in teams), more tutorials are written for your language, more people can help you to improve your knowledge of this language, etc. But if you feel that you are totally comfortable within your language and usage of this language doesn't cause you any trouble there is no reason to change things just because something is more popular. I think that it is better to focus on learning algorithms, language is just a tool.

There are plenty examples of long-term successful usage of languages that are less popular than C++ in CP such as Java, D lang, Go, Haskell and other.

I think no one can say will some language be comfortable for you in long term or not. Just try to actively use one language for a week or a month. And you will find it out by yourself.

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

Delphi and Scala are the best choices of course. Very object oriented and easy to debug.