题目传送门
/*
线段树的单点更新:有一个交叉更新,若rank=1,or;rank=0,xor
详细解释:http://www.xuebuyuan.com/1154895.html
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <set>
#include <map>
using namespace std;
#define lson l, mid, rt << 1
#define rson mid+1, r, rt << 1 | 1
const int MAXN = << | ;
const int INF = 0x3f3f3f3f;
struct NODE
{
int v, mx, mn, sum;
int rank;
}node[MAXN << ];
void push_up(int rt)
{
if (node[rt<<].rank == )
{
node[rt].rank = ;
node[rt].v = node[rt<<].v | node[rt<<|].v;
}
else
{
node[rt].rank = ;
node[rt].v = node[rt<<].v ^ node[rt<<|].v;
}
}
void build(int l, int r, int rt)
{
if (l == r)
{
scanf ("%d", &node[rt].v);
node[rt].rank = ;
return ;
}
int mid = (l + r) >> ;
build (lson);
build (rson);
push_up (rt);
}
void updata(int p, int b, int l, int r, int rt)
{
if (l == r)
{
node[rt].v = b;
return ;
}
int mid = (l + r) >> ;
if (p <= mid) updata (p, b, lson);
else updata (p, b, rson);
push_up (rt);
}
int main(void) //Codeforces Round #197 (Div. 2) D. Xenia and Bit Operations
{
//freopen ("H.in", "r", stdin);
int n, m;
scanf ("%d%d", &n, &m);
build (, <<n, );
int p, b;
for (int i=; i<=m; ++i)
{
scanf ("%d%d", &p, &b);
updata (p, b, , <<n, );
printf ("%d\n", node[].v);
}
return ;
}