Tehjeeb's blog

By Tehjeeb, history, 2 years ago, In English

My submission: https://mirror.codeforces.com/contest/1613/submission/161506133 Please someone help. I think I wrote the code correctly. It shouldn't get -1 as output(it may print any other wrong value but not -1)

  • Vote: I like it
  • -2
  • Vote: I do not like it

»
2 years ago, # |
  Vote: I like it +31 Vote: I do not like it

Your variable ans is zero modulo $$$998244353$$$ and you subtract $$$1$$$ from it. So your result is $$$-1$$$ but it should be $$$998244352$$$ (this is the same $$$-1$$$ but modulo $$$998244353$$$). So you should print something like (ans - 1 + M) % M instead of ans - 1.