### gyanendra371's blog

By gyanendra371, history, 7 months ago, ,

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;

}

}

•
• -7
•

 » 7 months ago, # |   0 Auto comment: topic has been updated by gyanendra371 (previous revision, new revision, compare).
 » 7 months ago, # | ← Rev. 3 →   0 .
•  » » 7 months ago, # ^ |   -8 what is he doing here
 » 7 months ago, # |   0 This is pretty simple. fsu[i][j] = The first index k,k > i, where ak doesn't have the j-th bit set. This is useful to know because the and operation is destructive and will only be able to change at most times. The next change is given by fsu[i][j].
•  » » 7 months ago, # ^ |   0 how do we know and is changing and why if the bit is off we store the last index.
•  » » » 7 months ago, # ^ |   0 and for what value and will be same and why? @pagenegod