Java - Input description- Time exceeded

Feel free to ask any questions related to the COJ.
Post Reply
cobe2
Posts: 2
Joined: 6 years ago
Gender: None specified

Java - Input description- Time exceeded

Post by cobe2 » 6 years ago

The first thing wich I want to be clear is that Java is slower that C.
Some times Java users (like me) have to use BufferedReader .readLine() instead of scanner because BR is faster than SC, we do it because we need that time to get ACC on time (Because some times inclusive with the correct aproach the time is not enought using SC).
Then, I've noticed that some problems have no clear specifications about the input description, I mean, they don't tell you if the input values will be on the same line or different lines or if they will have ending spaces or not, and that can cause RTE using BR.readLine().
I don't know if this is the correct place to say it, but it will be better if before the ACM ICPC programming contest all the input files of all the problems for all the places are in a correct format for java users, or at least they should specify that there can be issues on the input of any type.
Another thing is that in the past Mexico and Central America programming contest, they didnt specified the time limit for the problems, well I don't know if it have been allways that way, but I suppose they need to specify the time limit for us to calculate the time complexity of our algorithms and prove if they can be a correct aproach.

Sorry for the bad spelling.



User avatar
jelara
Posts: 37
Joined: 7 years ago
Location: Guadalajara, Mexico
Gender: Male
Mexico

Re: Java - Input description- Time exceeded

Post by jelara » 6 years ago

Hi cobe2:

You should note that your problem is not exclusive to Java: C++ developers have to remember not to use cin/cout because they are slow too, and always use scanf/printf. If your parse your input correctly, you should not get RTE even using BR.readLine(), the process just becomes a little more difficult.

However, you should note that there is a tendency in the recent years inside the ACM-ICPC to move the complexity away from the input/output formats, make the input process as simple as possible to allow the programmers to focus on the algorithms, so you shouldn't expect many problems on these contests. However, it's still a good skill to have.

Your complaint about the Mexico and Central America contest, you should take it to the director of the Mexico and Central America region, I'm sure he will be able to help you: remember we are the Caribbean region.

Best regards,

Post Reply

Return to “FAQ”