this logic by "imlazy" is an imperative!! i mean - OMG!!
my program was returning TLE, and it was expected, because i was doing brute force O(n^6) - [what ever that may mean, i saw others use these terms, so i assume it's some time/complexity mark..?!]
so i was brutally adding all possible rectangles.
and TLE, TLE and more TLE - 10+ sec.
then, i added these little 2 conditions:
1) if ( BOARD[j] <=0 ) don't_even_try_to_find_it's_sum(); else sum();
in my "sum()" function, i added this part:
2) if ( sum<=0 ) break;
and i got accepted, in 1.49 sec. O-M-G!!




thx for the idea,
best regards,
dootzky