Hi! chaitu. please have you taken part in  Google Code Jam before?
                  regards

John Zhang

On Wed, Apr 22, 2009 at 8:44 PM, chaithu <[email protected]> wrote:

>
> hi luke,
>
> i am glad that u replyed.  My situations is i have tried to work the
> problem in a logic which is killing the time.  I know that its a bad
> logic.  The logic was able to work for small input but the bigger one
> ( take time more than 3 hrs, easily ).  I downloaded the solution from
> contestant's solutions.  it was from mystic (8th ranker).  In the
> solution he/she used 2 functions :
>
> public void add(int pos) {
>                while (pos < 20000) {
>                        s[pos]++;
>                        pos = (pos | (pos-1)) + 1;
>                }
>        }
>
>        public int getSum(int pos) {
>                int sum = 0;
>                while (pos > 0) {
>                        sum += s[pos];
>                        pos &= pos - 1;
>                }
>                return sum;
>        }
> iam not able to understand these statements.
>
> Or if you know any other logic, please let me know that.
>
> thanks,
>  chaitu.
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to