SevenAlarm's blog

By SevenAlarm, history, 5 months ago, In English

I've been stuck with this problem for a couple of days. I came up with a strange 3-dimensional dp and the constraints actually allowed it, so I coded it and ran into wrong answers (nothing new)

Now I'm noticing that if the given inputs are all their maximum (250), it will be equivalent to a 250 * 250 board and the answer is 250! which cannot be stored. But the problem statement doesn't mention any guarantee, nor does it say that I should return the answer modulo 1e9 + 7 or something like that.

I'm getting wrong answer on test 15 (it could be a problem with my solution as well) but just asking, what's up with this?

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

»
5 months ago, # |
  Vote: I like it 0 Vote: I do not like it

You are right that the answer could be very large, but it seems testcases do not go there.

I got AC using a regular python code 270938473.

It's a nice DP problem.