ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1039. Anniversary Party

For those who WA5
Posted by Aksima 14 Jul 2018 02:16
Do not use signed char (C++) or signed byte (C#) to store convivality, or you get wrong results because of overflow.

The test 5 is:
7
1
1
100
100
1
1
1
1 3
2 3
6 4
7 4
4 5
3 5
0 0

After you sum 100 + 100, you get -56 in the signed char/signed byte variable, while the right sum should be 200.

Hope this helps.