Блог пользователя global_optimum

Автор global_optimum, история, 4 года назад, По-английски

For a few of the CSES Sorting and Searching problems, such as Apartments, Concert Tickets, and Traffic Lights, and Movie Festival 2, I can't avoid TLE on the largest testcases in java.

Here is code for Movie Festival 2, https://ideone.com/AKdglG

I am using bufferedreader already, but CSES time limit seems to strict. Any tips? Or should I accept my fate as a java user and not care since CF and other platforms don't have 1sec limits?

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

I have had the same fate as you. In many of the CSES problems the simple streamReader IO is not enough, you will need to implement buffered reading yourself, I used the 4th code from here https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/ , that has so far gotten most codes ac'ed in CSES for me.

Also to people downvoting, I don't see any reason this question should be downvoted. If you think it's a copy of an old question, the minimum you could do before downvoting is post a link to an old question, no?

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Having the same issue here, hopefully pllk can make a change for this.

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I've avoided some TLEs by taking out the multiple print statementsand appending to a StringBuilder instead. Then I print just once at the very end.

»
10 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can someone share their code in python language of "CSES: Concert Ticket"? I have used binary search in my code. But still getting TLE.. Don't know how to modify it further.