Hey,
I'm a beginner in competitive programming, training on CSES and Codeforces and I'm facing an issue with some CSES problems that seem impossible to solve in Python because of time limits, though I see others have done it according to the statistics.
After hours of struggling with the "Concert Tickets" problem and failing to pass the time limit, I'd like to know if anyone has tips, solutions, or editorials to help me pass it using Python3 compiled with PyPy3.
Thanks in advance!
Submission AC code for Concert Tickets in PyPy3, use sys.stdin.readline() for input, this is a lot more faster than normal input.
Also it is gonna be really frustating to do the problem set in Python due to the time constraints of CSES, I end up optimizing small stuff like using bitwise operations rather than arithmetic and stuff like that.
You can also solve it using a DSU to simulate the removal of an ticket after selling it to a customer(point parent to the previous ticket in the sorted order). here's my solution in python:
Anyway, you're better off using C++ as it has set/multiset data structure and most of the problemset has tight limits like this problem.
Thank you so much for your answers guys ! The thing is, I really want to improve in Python rather than C++ since it's the go-to language for machine learning and AI, which I want to focus on. So this brings me to another question : - Do competitions like Codeforces or in-person events like ICPC have the same time limit issues with Python as CSES does?