Блог пользователя NTaveras

Автор NTaveras, 11 лет назад, По-английски

Hello,

My friend 53645 was trying to solve Problem 348A - Mafia 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!.

  • Проголосовать: нравится
  • -18
  • Проголосовать: не нравится

»
11 лет назад, # |
Rev. 4   Проголосовать: нравится +15 Проголосовать: не нравится

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.