code_hard123's blog

By code_hard123, history, 8 years ago, In English

Hi all,

My solution to problem http://codeforces.com/contest/688/problem/D

gave RuntimeError when i took array input before and then processed.

But the same code gave AC when I processed simultaenously while taking input.

I have no idea why the first code gave runtime error :(

RUNTIME ERROR CODE- http://codeforces.com/contest/688/submission/18818380

AC CODE — http://codeforces.com/contest/688/submission/18818424

Thank you :))

  • Vote: I like it
  • +1
  • Vote: I do not like it

| Write comment?
»
8 years ago, # |
  Vote: I like it +7 Vote: I do not like it

Read the constraints of the question. Maximum number of elements is 10^6 not 10^5. So your array size is declared wrongly, hence giving runtime error.