// original: // https://yukicoder.me/submissions/569228 #pragma GCC optimize("Ofast") #pragma GCC target("avx2") char*mmap(); #define RD(v) int v=0;{int c;while(c=*rp++-48,c>=0)v=v*10+c;} union{ int a[100000]; char wbuf[16*100000]; }u; #define a u.a #define wbuf u.wbuf int main() { char*rp=mmap(0l,11*200003,1,2,0,0ll); int x = 0, y = 0; long tot = 0; char* s; RD(n); RD(q); for (int i = 0; i < n; i++) { RD(x); a[i]=x; } s=rp; rp+=n+1; for (int i = n; i-- ;) if (!(s[i]&1)) { x |= ~a[i]; tot += y ^ (y & ~x); y &= ~x; } else { y |= a[i]; tot += x ^ (x & ~y); x &= ~y; } char*wp=wbuf; for(int i=0;i