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

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

I submitted code for Div2 408 Problem C. And it showed runtime error for the test case 2 while on my pc it is giving fine result although my algo is wrong but I still don't get why this one occured I check the same code on hackerrank and it gave proper result there too. Can anyone tell what's happened? this is my code

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

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

I can tell you that int pretest 2, when your program is running at line 75, cal(root) (which root=4) called cal(2), then called cal(1), then at line 36, neighbor.size() is 1 but you tried to read neighbor[j] which j = 1, and it caused RE.