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 1005. Stone Pile

Brute Force after rejudge
Posted by TinyJanssen 31 Mar 2013 04:53
I got an error on #8 after rejudging the problem. First i got AC.
This time I tried a brute force approach.
first i generated al binary digits from 0 to 2^N.
then i counted sum of the stones where the bit was 1.
The difference total-2*sum had to be minimal.

AC in 0.2 sec
Re: Brute Force after rejudge
Posted by retNAN 27 May 2013 09:49
I tried this approach but got TLE for test 3. Question i keep asking myself is, "Must you check all the 2^N combinations. if "No" how should you set your break point?
Re: Brute Force after rejudge
Posted by Erop [USU] 31 May 2013 23:40
Try to write more effective code, don't use string and set at all!
Re: Brute Force after rejudge
Posted by retNAN 11 Jun 2013 19:57
Erop [USU] wrote 31 May 2013 23:40
Try to write more effective code, don't use string and set at all!
Thank You. Just nailed it.