NTaveras's blog

By NTaveras, 11 years ago, In English

Hello,

My friend 53645 was trying to solve Problem 348A - Мафия and after getting lots of Wrong Answer he changed a few variables from long long to int and got Accepted.

Can anyone please explain what happened? We couldn't find an explanation.

Wrong answer using long long: 4600792

Accepted using int: 4600933

You can use Diffnow to see the difference in both codes highlighted.

Thanks!.

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

»
11 years ago, # |
Rev. 4   Vote: I like it +15 Vote: I do not like it

The change from long long to int was not the reason why he go AC. He go AC because he lowered initial value of long long hi.

WA: 
long long  hi = 1000000000000000LL;
AC:
long long  hi = 10000000000000LL;

In function check(v) there is variable cnt, whicn can be up to v*n. It overflowed with too big hi.