How can I avoid stackoverflow in this problem? (1335F — Robots on a Grid) (Java)

Правка en1, от idk321, 2020-04-25 11:12:44

Here is my whole program: https://pastebin.com/dqqGn0rn. Here is the part of the program where the overflow happens: https://pastebin.com/JCCj8knQ. I get this error on a test with a million nodes: https://pastebin.com/eCxBK4pf. Is perhaps the language is use (Java) the problem? Can I fix this without making it iteratively and without changing my language?

Теги #java, #cycle, #stack, #help error

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en5 Английский idk321 2020-04-25 15:28:49 82
en4 Английский idk321 2020-04-25 11:46:37 169
en3 Английский idk321 2020-04-25 11:14:50 75
en2 Английский idk321 2020-04-25 11:13:52 91
en1 Английский idk321 2020-04-25 11:12:44 437 Initial revision (published)