i have submitted the code in contest and it was accepted(even the solution was not hacked) and when i submitted the same code in pypy3 it was accepted.Then i saw others solution i found that everyone was having same complexity as me and submitted in python 3 only and their solution was accepted. question- https://codeforces.me/contest/1675/problem/B my contest submition — https://codeforces.me/contest/1675/submission/155950529 my pypy3 submition- https://codeforces.me/contest/1675/submission/156065421 a correct submition for referrence- https://codeforces.me/contest/1675/submission/156006177
Auto comment: topic has been updated by abcsumits (previous revision, new revision, compare).
yes I think u are right.
sad life <*--*>
It seems that you are right, and the only conclusion from this is the idea that python language isn't the best choice for competive programming. You can use it but sometimes such interest things will happen. That's the reason why I changed my lang from python to c++
but the same solution of someone else has been accepted in python.(he hasnt use stdin i/o method and i have used stdin method which means my code is faster than accepted one..) i have mentioned that solution..
You are right and your words are just this reason. Python code is enough slow and some little difference in two solutions can be the reason that one of them will be accepted and the second will not. You can do nothing this such fact — if your are using python in some cases you will get TLE just because you are using python. It's not so noticeably when the problems are not hard but when you will solve harder and harder problems the number of problems with python will grow up so you will be forced to use c++/java instead of python. What lang to use is your choice I just tell you that the only problem of this situation is python, yeah.
so should i change my lang?
If you plans for growing up in competitive programming are enough great (1600+) I think that it may be a good idea. If you take a look for the people in the top for rating you can notice that no one from them using python and it's not coincidence.
did i still need to change it(check out profile first, i am underperforming rn)
At your current level that will not give your many pluses. An idea to change your lang for c++/java will help you in future when the problems you solve will be a bit more difficult. So finally the choice is yours. I can just say that there wasn't be a moment when I regretted changing the language
The other persons Python3 solution ran in 1996 ms / 2000 ms. Even submitting that exact code again could very likely get TLE. I would not call a solution that runs in 1996 ms / 2000 ms "a correct submition for referrence".
I would also like to note that your code uses
l[i]=l[i]//2
and the code you linked usesq = q//2
. In Python repeatedly indexing a list is pretty expensive, it is not free like in C++. So I think your implementation is significantly slower than the 1996 ms / 2000 ms solution.Thanks this thing me helped me now:)
Nice ping
I know I am too fast :)
lis05 now my ping is better:)
Nice!
Now I will reply after 3 months:)
lis05 remembered me?
Hey there! Nice ping, it has improved from 5 months to 3 months!
What about now?
IS it better Now?
Yeah, now it's fine
lis05 how's it? And happy new year
Well it's getting better and better.
Thanks, you too!
Hello. How are you doing? It's been a while. Has your ping improved since the last time?
You can use this code to make I/O faster, I used to use python and had no problem whatsoever in speed. I recently changed to c++ and I do not really regret it. C++ is not "that hard" to learn.