Unnecessary TLE in JAVA in LTime75A

Exactly!!
Faced the same problem

1 Like

I guess. Or probably Treeset in JAVA. I got a TLE when i used TreeSet in a recent contest on codechef

You are correct, but if codechef keeps multiple testers like in codeforces then this problem can be reduced to an extent

I see you used TreeSet. Java’s TreeSet is not as fast as stl:set of C++, which caused you the TLE. Now when you use a language, you should know your tools well. I am also a Java coder and in this problem I wouldn’t use Set, instead I would use other data-structures (like segment tree or fenwick tree) because of the larger constraints. But sadly that would require lot more coding.
I think problem setter and tester could do a better job here. They could lower the constraints (like, sum of N,Q is 10^5 in all test cases). Thus the problem and solution would remain same but those time-limit issues could have been avoided. I hope they will keep this in mind in the future contests.

4 Likes

actually testers for only three languages i.e c++, java and python will cover 99.9999% of people

Couldn’t have said it better.
Also can you tell me how can you implement it using segtree or BIT?

same issue.coke2 doesn’t pass in python
same logic passes in c++.
Timelimits should be customized for c++,java and python and not fixed time multipliers

python-https://www.codechef.com/viewsolution/26184441
c+±https://www.codechef.com/viewsolution/26231434

try using StringBuffer to accumulate the answers and then print it in one go.
This has helped me many time as I also prefer JAVA.

The same happened with me in this Long Challenge. This was for problem CHEFK1.
https://www.codechef.com/SEPT19B/problems/CHEFK1

We can’t discuss it until the Contest is over.

okay…if you have done can i contact you after the contest is over?

No need to contact me personally - all solutions will be visible soon after the contest ends, and hopefully the Editorial will be posted soon after that. Lots of people will be posting solutions :slight_smile:

do they post editorial for all the problems … because this https://www.codechef.com/LTIME75B/problems/EQAVG
problem has no editorial

Perhaps not all, but most. AUG19 eventually had all Editorials posted, though there was a bit of a delay. I posted a whole bunch of solutions for AUG19B with heavily-commented code and an Editorial-style overview for each one, and hopefully I’ll be doing the same this time around :slight_smile:

Edit:

Real-life has intervened, and there will be a delay for mine - hopefully all will be posted by end of Monday, GMT :slight_smile:

2 Likes

thank you brother…I will be waiting for your solutions

1 Like

I really like your style of making editorials. I’ve prepared a few myself too. I’ll be posting them when the contest ends. Hope those aren’t too bad. :slightly_smiling_face:

1 Like

Yeah. If the editorial isn’t posted immediately after the contest, feel free to contact me. I’d love to be of some help.