Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

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

Автор _12345_, история, 9 лет назад, По-английски

Hello CodeForces ,, this Problem in SPOJ (EDIST) I've solved it using dynamic programming "Recursion Method" but actually it gives me RTE in Java

The same algorithm Using C++ syntax gives me Accepted

Can You Please Explain How is That Happens? and How to Avoid Such Problem if it Face me in Future ?

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

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

Auto comment: topic has been updated by _12345_ (previous revision, new revision, compare).

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

Use c++ to avoid this.

  • »
    »
    9 лет назад, # ^ |
      Проголосовать: нравится +8 Проголосовать: не нравится

    this is not an answer for my question ! I want a solution that doesn't required changing programming language ! thanks

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

      Well, Java is just slower than C++ and there is nothing you can do about it. I guess you can try optimizing your Java code by doing things like using BufferedReader vs. using Scanner. It is just that SPOJ is very strict with time limits that it becomes harder to pass with Java solutions rather than C++ solutions.