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

Автор 69_LoVeRGuY, история, 3 года назад, По-английски

I was attempting the CSES Apartments problem and here is my solution in java. I've used the two pointer approach but still I have a timeout in one of the testcases. Someone please help me understand the shortcoming in my code.

Thanks in advance.

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

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

We can't see that solution. If you go to the submission page, there is a blue button that says "Share code to others". If you hit that and copy the link, we can see the code.

  • »
    »
    3 года назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    I can. This is the submission:

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

Java is just slow, if you want AC use C++ but otherwise don't mind it since the CSES grader is naturally slow.

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

Have nobody taught you to not use Arrays.sort()? C'mon dude. Use Collections.sort() instead.