irajdeep's blog

By irajdeep, history, 9 years ago, In English

So I made two submissions to this problem.

While this solution gets WA at test case 39, this onegets Accepted. While the only difference between them is in the order of calculating a1 and a2. Can anyone help me with the reason as why does the order make a difference? Thanks

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I'm not quite sure, but I believe actually both solutions are incorrect. Because, the memo should take into consideration the "flag" state as well. Answers can differ depending if it's 1 or 0. I just modified that and I got AC : http://codeforces.com/contest/577/submission/12962910.