|  | 
|  | 
| вернуться в форум | Brute Force after rejudge 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 Послано retNAN  27 май 2013 09:49I 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 Try to write more effective code, don't use string and set at all!Re: Brute Force after rejudge Послано retNAN  11 июн 2013 19:57Try to write more effective code, don't use string and set at all!  Thank You. Just nailed it. | 
 | 
|