Using Python, is it possible to pass all the test cases for USACO silver problems within the time limit?

I recently implemented the official solution to USACO Silver 2018 January - Rental Service in python and I got TLE after testcase 5. If someone has a solution to that question in python, would it be possible to share it? I thought the time limit for python in USACO specifically passes python programs as long as they are using the optimal solution. Is this problem very frequent in silver division? I am trying to get to gold by US Open this year and I probably don’t have enough time to switch languages. Also, this does not seem to be a problem for any bronze problems.

1 Like

see https://usaco.guide/general/factors-choosing#time-limit

Yeah- the heavy majority of bronze problems are solvable with Python.

However, when you get to Silver, Python’s large constant factor starts to become a major problem. And it isn’t that hard to switch to new languages once you get the concepts themselves down.

1 Like

Yeah I want to switch to C++ for its efficiency but I don’t think it would be that doable if I want to get my skills up to silver standards by US open this year.

How frequent does the TLE regardless of correct implementation problem occur in silver? Should I continue learning silver concepts and doing silver questions in python? I do have a AP CSA level foundation in java but the language is so wordy…even though this won’t be that much of a problem in java.

I plan to get to silver in the coming February contest and hopefully get gold in US open. I also know that you don’t necessarily have to get a perf score to advance so perhaps the TLE cases might not be a problem given that I correctly implemented a solution.

For Bronze problems, a python solution can always be guaranteed to pass all 10 test cases. However, I recommend you change to C++ once you get to USACO Silver. Getting to gold with Python is extremely difficult, so I recommend a C++ change if you don’t already know Java. This TLE problem occurs for half of the Silver problems. In particular, it times out with test cases having large inputs.

2 Likes

Sometimes, two problems in the same contest can’t be solved using Python, so I wouldn’t really take your chances.

2 Likes

Thank you! This was the information I needed. I wonder why USACO couldn’t adjust the time limits for python accordingly though…like couldn’t the problem makers code up the optimal solution in python, time it, and then set the time limit for that question so people who use python can still get credit?

Python already has a longer time limit, and I guess they can only go as far as 4 seconds to maybe reduce the stress on their servers?

Yeah most likely. Is it possible to get to gold using java? I think brushing up on java is the best solution here to the situation since I already have a foundation in java from CSA? If it isn’t possible, I suppose I will have to learn CPP from scratch in a month…

It’s possible to get to IOI with java…

1 Like

It’s really hard though :man_shrugging:. The only IOI member who used Java was Danny Mittal from last season.

Right but there are only 4 IOI members :slight_smile:

I was referring to the first IOI member in history not particularly last year.

Fair enough but java was only allowed at ioi since 2016. Anyways, I guess we can say it is possible but hard.

Note that this is no longer true. See the 2021 rules, which state that Java is not supported at this years IOI.

1 Like