#include<cstdio>
int T[2][2097152];
int d[2][20];
void update(int x,int y,int z)
{
if(y==0)return;
d[x][z]-=!!T[x][y];
if(T[x][y<<1]==T[x][(y<<1)+1])T[x][y]=T[x][y<<1];
else T[x][y]=0;
d[x][z]+=!!T[x][y];
update(x,y>>1,z-1);
}
int main()
{
int i,j,n,m;
scanf("%d%d",&n,&m);
for(i=0;i<2;i++)for(j=1;j<(2<<n);j++)T[i][j]=1;
for(i=0;i<2;i++)for(j=0;j<n;j++)d[i][j]=1<<j;
while(m--)
{
scanf("%d%d",&i,&j);
T[i][j+(1<<n)-1]=-T[i][j+(1<<n)-1];
update(i,(j+(1<<n)-1)>>1,n-1);
j=0;
for(i=0;i<n;i++)j+=((1<<i)<<i)-d[0][i]*d[1][i];
printf("%d\n",(j<<2)+1);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
17472 KB |
Output is correct |
2 |
Correct |
0 ms |
17472 KB |
Output is correct |
3 |
Correct |
0 ms |
17472 KB |
Output is correct |
4 |
Correct |
0 ms |
17472 KB |
Output is correct |
5 |
Correct |
0 ms |
17472 KB |
Output is correct |
6 |
Correct |
0 ms |
17472 KB |
Output is correct |
7 |
Correct |
0 ms |
17472 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
17472 KB |
Output is correct |
2 |
Correct |
0 ms |
17472 KB |
Output is correct |
3 |
Correct |
0 ms |
17472 KB |
Output is correct |
4 |
Correct |
0 ms |
17472 KB |
Output is correct |
5 |
Correct |
0 ms |
17472 KB |
Output is correct |
6 |
Correct |
0 ms |
17472 KB |
Output is correct |
7 |
Correct |
0 ms |
17472 KB |
Output is correct |
8 |
Correct |
0 ms |
17472 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1416 ms |
17472 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |