gyanendra371's blog

By gyanendra371, history, 6 years ago, In English

question and discussion link https://discuss.codechef.com/questions/135298/andsqr-editorial

somebody explain bit easier what the editor was doing here ; not able to understand

LL fsu[31][N];

    for(i=0;i<31;i++)//Initialize 

        fsu[i][n]=n+1;

    for(i=n-1;i>=1;i--)
    {

        for(j=0;j<31;j++)
        {

            if((1<<j)&a[i+1])//If the bit is set

                fsu[j][i]=fsu[j][i+1];

            else //If the bit changes

                fsu[j][i]=i+1;

        }

    }

Full text and comments »

  • Vote: I like it
  • -7
  • Vote: I do not like it