Handling possibly large answers? acmsguru — 269

Revision en1, by SevenAlarm, 2024-07-17 00:53:40

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?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English SevenAlarm 2024-07-17 00:53:40 740 Initial revision (published)